wangchuanjin преди 5 години
родител
ревизия
6adcf02bd4

+ 70 - 82
src/jfw/front/front.go

@@ -568,27 +568,11 @@ func (f *Front) Login(key string) error {
 	shareid := se.DecodeString(key)
 	shareid := se.DecodeString(key)
 	openid := redis.GetStr("sso", "p_usershare_"+shareid)
 	openid := redis.GetStr("sso", "p_usershare_"+shareid)
 	if openid != "" {
 	if openid != "" {
-		f.SetSession("openid", openid)
-		redisheadimg := redis.Get("other", "newUser-"+openid)
-		if redisheadimg == nil {
-			redisheadimg = ""
-		}
-		user, _ := mongodb.FindOneByField("user", `{"s_m_openid":"`+openid+`"}`, `{"s_nickname":1,"s_headimage":1,"s_m_openid":1,"_id":1}`)
-		if user != nil && len(*user) > 0 {
-			f.ServeJson(map[string]string{
-				"result":       "ok",
-				"s_nickname":   fmt.Sprint((*user)["s_nickname"]),
-				"s_headimage":  fmt.Sprint((*user)["s_headimage"]),
-				"redisheadimg": fmt.Sprint(redisheadimg),
-				"encryptId":    se.EncodeString(util.BsonIdToSId((*user)["_id"])),
-			})
+		ok, user, userInfo := FindUserAndCreateSess(openid, f.Session())
+		if ok {
 			(*user)["shareid"] = shareid
 			(*user)["shareid"] = shareid
-			nick := fmt.Sprint((*user)["s_nickname"])
-			f.SetSession("nickname", nick)
-			f.SetSession("s_nickname", nick)
-			f.SetSession("s_m_openid", fmt.Sprint((*user)["s_m_openid"]))
-			f.SetSession("userId", util.BsonIdToSId((*user)["_id"]))
 			f.SetSession("user", *user)
 			f.SetSession("user", *user)
+			f.ServeJson(userInfo)
 		} else {
 		} else {
 			f.ServeJson(map[string]string{
 			f.ServeJson(map[string]string{
 				"result": "fail",
 				"result": "fail",
@@ -604,31 +588,24 @@ func (f *Front) Login(key string) error {
 
 
 //用户是否登录
 //用户是否登录
 func (f *Front) HasSign() error {
 func (f *Front) HasSign() error {
-	tmp := f.Session().Get("user")
-	openid := f.GetSession("s_m_openid")
-	if openid == nil {
-		openid = ""
-	}
-	redisheadimg := redis.Get("other", "newUser-"+openid.(string))
-	if redisheadimg == nil {
-		redisheadimg = ""
-	}
-	if user, ok := tmp.(map[string]interface{}); ok {
-		f.Session().Set("user", user)
-		f.ServeJson(map[string]string{
-			"result":       "ok",
-			"s_nickname":   fmt.Sprint(user["s_nickname"]),
-			"s_headimage":  fmt.Sprint(user["s_headimage"]),
-			"redisheadimg": fmt.Sprint(redisheadimg),
-			"encryptId":    se.EncodeString(util.BsonIdToSId(user["_id"])),
-		})
+	if userId, _ := f.GetSession("userId").(string); userId != "" {
+		m := map[string]interface{}{
+			"result":      "ok",
+			"s_nickname":  f.GetSession("s_nickname"),
+			"s_headimage": f.GetSession("s_avatar"),
+			"encryptId":   se.EncodeString(userId),
+		}
+		if openid, _ := f.GetSession("s_m_openid").(string); openid != "" {
+			m["openid"] = se.EncodeString(openid)
+			m["redisheadimg"] = util.ObjToString(redis.Get("other", "newUser-"+openid))
+		}
+		f.ServeJson(m)
 	}
 	}
 	return nil
 	return nil
 }
 }
 
 
 //用户注销
 //用户注销
 func (f *Front) SignOut() error {
 func (f *Front) SignOut() error {
-	log.Println("userId----1", f.GetSession("userId"))
 	f.DelSession("rpcBackUserInfo")
 	f.DelSession("rpcBackUserInfo")
 	f.DelSession("user")
 	f.DelSession("user")
 	f.DelSession("s_nickname")
 	f.DelSession("s_nickname")
@@ -638,28 +615,6 @@ func (f *Front) SignOut() error {
 	f.DelSession("DataExportVerifyEmail_val")
 	f.DelSession("DataExportVerifyEmail_val")
 	f.DelSession("DataExportVerifyPhone_val")
 	f.DelSession("DataExportVerifyPhone_val")
 	f.ServeJson("ok")
 	f.ServeJson("ok")
-	log.Println("userId----2", f.GetSession("userId"))
-	//sess := f.GetSession("user")
-	//if user, ok := sess.(map[string]interface{}); ok {
-	//shareid := fmt.Sprint(user["shareid"])
-	//		redis.Del("sso", "p_usershare_"+shareid)
-	//		//重新生成二维码,
-	//		id, _ := strconv.Atoi(shareid)
-	//		public.GetShareQR(uint32(id))
-	//
-	//		expires := time.Now().Add(-2 * time.Hour)
-	//		log.Println("exp:", expires)
-	//		cookie := &http.Cookie{
-	//			Name:     "userid_secure",
-	//			Value:    "",
-	//			Path:     "/",
-	//			HttpOnly: true,
-	//			MaxAge:   0,
-	//			Expires:  expires,
-	//		}
-	//		log.Println("cookie:", cookie)
-	//		f.SetCookie(cookie)
-	//}
 	return nil
 	return nil
 }
 }
 
 
@@ -786,29 +741,62 @@ func (m *Front) Wxerr() error {
 }
 }
 
 
 //查找用户并创建session
 //查找用户并创建session
-func FindUserAndCreateSess(openid string, sess *httpsession.Session) (ok bool) {
-	_person, ok := public.MQFW.FindOne("user", bson.M{"s_m_openid": openid})
-	if ok && *_person != nil && len(*_person) > 0 {
-		person := *_person
-		//加入session
-		//		if person["i_know"] != nil {
-		//			sess.Set("iknow", person["i_know"])
-		//		}
-		if person["i_shareknow"] != nil {
-			sess.Set("shareknow", person["i_shareknow"])
-		}
-		sess.Set("userId", (person["_id"].(bson.ObjectId)).Hex())
-		sess.Set("s_m_openid", person["s_m_openid"])
-		sess.Set("openid", person["s_m_openid"])
-		sess.Set("s_nickname", person["s_nickname"])
-		if person["s_avatar"] == nil {
-			sess.Set("s_avatar", person["s_headimage"])
-		} else {
-			sess.Set("s_avatar", person["s_avatar"])
+func FindUserAndCreateSess(openid string, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
+	return CreateSession(map[string]interface{}{
+		"s_m_openid": openid,
+	}, sess)
+}
+
+func FindUserAndCreateSessById(userId bson.ObjectId, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
+	return CreateSession(map[string]interface{}{
+		"_id": userId,
+	}, sess)
+}
+
+func CreateSession(q map[string]interface{}, sess *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
+	if q == nil || len(q) == 0 {
+		return false, nil, nil
+	}
+	person, ok := public.MQFW.FindOneByField("user", q, `{"_id":1,"i_shareknow":1,"s_m_openid":1,"s_nickname":1,"s_headimage":1,"s_headimageurl":1,"s_phone":1}`)
+	if !ok || person == nil || len(*person) == 0 {
+		return false, nil, nil
+	}
+	sess.Set("user", *person)
+	if (*person)["i_shareknow"] != nil {
+		sess.Set("shareknow", (*person)["i_shareknow"])
+	}
+	openid, _ := (*person)["s_m_openid"].(string)
+	sess.Set("userId", ((*person)["_id"].(bson.ObjectId)).Hex())
+	nickName, _ := (*person)["s_nickname"].(string)
+	if nickName == "" {
+		if phone, _ := (*person)["s_phone"].(string); phone != "" && len(phone) > 3 {
+			nickName = string(phone[0:3]) + "****" + string(phone[len(phone)-4:])
 		}
 		}
-		//go updateUserPushStatus(util.BsonIdToSId(person["_id"]))//取关用户扫码不关注,直接点菜单,逻辑有误注释 20190910
 	}
 	}
-	return
+	sess.Set("s_nickname", nickName)
+	sess.Set("nickname", nickName)
+	avatar := ""
+	if (*person)["s_avatar"] != nil {
+		avatar, _ = (*person)["s_avatar"].(string)
+	} else if (*person)["s_headimage"] != nil {
+		avatar, _ = (*person)["s_headimage"].(string)
+	} else if (*person)["s_headimageurl"] != nil {
+		avatar, _ = (*person)["s_headimageurl"].(string)
+	}
+	sess.Set("s_avatar", avatar)
+	infoData := map[string]interface{}{
+		"result":      "ok",
+		"s_nickname":  nickName,
+		"s_headimage": avatar,
+		"encryptId":   se.EncodeString(util.BsonIdToSId((*person)["_id"])),
+	}
+	if openid != "" {
+		infoData["redisheadimg"] = util.ObjToString(redis.Get("other", "newUser-"+openid))
+		infoData["openid"] = se.EncodeString(openid)
+		sess.Set("s_m_openid", openid)
+		sess.Set("openid", openid)
+	}
+	return ok, person, infoData
 }
 }
 
 
 //微信跳转创建session
 //微信跳转创建session
@@ -821,7 +809,7 @@ func (m *Front) Sess(ostr string) error {
 	str := strings.Split(sewx.DecodeString(strs[0]), ",")
 	str := strings.Split(sewx.DecodeString(strs[0]), ",")
 	if len(str) == 4 {
 	if len(str) == 4 {
 		openid := str[0]
 		openid := str[0]
-		ok := FindUserAndCreateSess(openid, m.Session())
+		ok, _, _ := FindUserAndCreateSess(openid, m.Session())
 		if ok {
 		if ok {
 			actionurl := util.ObjToString(urlMap[str[3]])
 			actionurl := util.ObjToString(urlMap[str[3]])
 			if actionurl != "" {
 			if actionurl != "" {

+ 234 - 0
src/jfw/front/login.go

@@ -0,0 +1,234 @@
+package front
+
+import (
+	"jfw/config"
+	qutil "qfw/util"
+	"qfw/util/jy"
+	"regexp"
+	"strings"
+	"time"
+
+	"github.com/dchest/captcha"
+	"github.com/go-xweb/httpsession"
+	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
+)
+
+type Login struct {
+	*xweb.Action
+	login     xweb.Mapper `xweb:"/phone/login"`     //登录
+	forgetPwd xweb.Mapper `xweb:"/phone/forgetPwd"` //忘记密码
+}
+
+var (
+	passwordReg = regexp.MustCompile(".{6,}")
+)
+
+func init() {
+	xweb.AddAction(&Login{})
+}
+func (l *Login) Login() error {
+	defer qutil.Catch()
+	result := map[string]interface{}{}
+	reqType := l.GetString("reqType")
+	status := func() int {
+		if reqType == "phoneLogin" {
+			phone := l.GetString("phone")
+			password := l.GetString("password")
+			if strings.TrimSpace(phone) == "" {
+				return -1
+			} else if strings.TrimSpace(password) == "" {
+				return -2
+			}
+			user, ok := mongodb.FindOneByField("user", map[string]interface{}{
+				"i_appid": 2,
+				"s_phone": phone,
+			}, `{"s_password":1}`)
+			if ok && user != nil && len(*user) > 0 {
+				if qutil.ObjToString((*user)["s_password"]) == qutil.GetMd5String(password) {
+					ok, _, userInfo := afterLogin(phone, l.Session())
+					if ok {
+						result["userInfo"] = userInfo
+						return 1
+					}
+				} else {
+					return -2
+				}
+			} else {
+				return -1
+			}
+		} else if reqType == "sendIdentCode" {
+			phone := l.GetString("phone")
+			if !phoneReg.MatchString(phone) {
+				return -1
+			} else if tmp := l.GetSession("CheckCodeId"); tmp == nil || !captcha.VerifyString(tmp.(string), l.GetString("code")) {
+				return -2
+			} else if jy.SendPhoneIdentCode(phone, l.Session()) {
+				return 1
+			}
+			return 0
+		} else if reqType == "identCodeLogin" {
+			phone, _ := l.GetSession("identCodeKey").(string)
+			if phone == "" || l.GetSession("identCodeValue") == nil || l.GetString("identCode") != l.GetSession("identCodeValue") { //验证码不正确
+				return -1
+			} else {
+				//用户不存在
+				if !userIsExists(phone) {
+					data := map[string]interface{}{
+						"i_appid":       2,
+						"s_phone":       phone,
+						"s_password":    "",
+						"l_registedate": time.Now().Unix(),
+						"i_ts_guide":    2,
+						"o_jy": map[string]interface{}{
+							"i_apppush":    1,
+							"i_ratemode":   2,
+							"l_modifydate": time.Now().Unix(),
+						},
+					}
+					_id := mongodb.Save("user", data)
+					if _id != "" {
+						jy.ClearPhoneIdentSession(l.Session())
+						ok, _, userInfo := afterLogin(phone, l.Session())
+						if ok {
+							result["userInfo"] = userInfo
+							return 1
+						}
+					}
+				} else {
+					jy.ClearPhoneIdentSession(l.Session())
+					ok, _, userInfo := afterLogin(phone, l.Session())
+					if ok {
+						result["userInfo"] = userInfo
+						return 1
+					}
+				}
+			}
+		}
+		return 0
+	}()
+	result["status"] = status
+	l.ServeJson(result)
+	return nil
+}
+
+//忘记密码
+func (l *Login) ForgetPwd() error {
+	defer qutil.Catch()
+	if l.Method() == "GET" {
+		var shareid = l.GetString("id")
+		if len(shareid) == 0 {
+			shareid = "10"
+		}
+		l.T["logid"] = config.Seoconfig["wjmm"].(string)
+		l.T["shareid"] = se.EncodeString(shareid)
+		return l.Render("/login/forgetPwd.html", &l.T)
+	}
+	status := func() string {
+		reqType := l.GetString("reqType")
+		if reqType == "sendIdentCode" { //发短信
+			phone := l.GetString("phone") //手机号
+			//手机号验证不通过
+			if !phoneReg.MatchString(phone) {
+				return "phoneError"
+			}
+			if tmp := l.GetSession("CheckCodeId"); tmp == nil || !captcha.VerifyString(tmp.(string), l.GetString("code")) {
+				return "codeError"
+			}
+			//手机号是否已被注册
+			if mongodb.Count("user", map[string]interface{}{"s_phone": phone, "i_appid": 2}) == 0 {
+				return "phoneNotExists"
+			} else if jy.SendPhoneIdentCode(phone, l.Session()) {
+				return "y"
+			}
+		} else if reqType == "nextStep" {
+			if l.GetSession("identCodeValue") == nil || l.GetString("identCode") != l.GetSession("identCodeValue") { //验证码不正确
+				return "identCodeError"
+			}
+			l.SetSession("forgetPwdStep", "2")
+			return "y"
+		} else if reqType == "save" {
+			if l.GetSession("forgetPwdStep") == nil {
+				return "error"
+			}
+			phone, _ := l.GetSession("identCodeKey").(string)
+			if phone == "" {
+				return "timeout"
+			}
+			password := strings.TrimSpace(l.GetString("password"))
+			if !passwordReg.MatchString(password) {
+				return "passwordError"
+			}
+			user, ok := mongodb.FindOneByField("user", map[string]interface{}{
+				"i_appid": 2,
+				"s_phone": phone,
+			}, `{"s_password":1}`)
+			if !ok || user == nil {
+				return "userNotExists"
+			}
+			oldpwd, _ := (*user)["s_password"].(string)
+			if oldpwd == qutil.GetMd5String(password) {
+				return "passwordRepeat"
+			}
+			query := map[string]interface{}{
+				"i_appid": 2,
+				"s_phone": phone,
+			}
+			if mongodb.Update("user", query, map[string]interface{}{"$set": map[string]interface{}{"s_password": qutil.GetMd5String(password), "l_updatepwdtime": time.Now().Unix()}}, false, false) {
+				l.DelSession("forgetPwdStep")
+				jy.ClearPhoneIdentSession(l.Session())
+				return "y"
+			}
+			return "saveError"
+		}
+		return "n"
+	}()
+	//返回
+	l.ServeJson(map[string]string{
+		"status": status,
+	})
+	return nil
+}
+
+/**********************************************************************
+***********************************************************************
+***********************************************************************/
+//手机号用户是否存在
+func userIsExists(phoneNum string) bool {
+	query := map[string]interface{}{
+		"s_phone": phoneNum,
+		"i_appid": 2,
+	}
+	return mongodb.Count("user", query) > 0
+}
+
+//是否存在微信手机号账户
+func findWxExistsId(phoneNum string) interface{} {
+	query := map[string]interface{}{
+		"s_m_phone": phoneNum,
+		"i_appid":   2,
+	}
+	res, _ := mongodb.FindOneByField("user", query, `{"_id":1}`)
+	if res != nil && len(*res) > 0 {
+		return (*res)["_id"]
+	}
+	return nil
+}
+
+//
+func afterLogin(phone string, session *httpsession.Session) (bool, *map[string]interface{}, map[string]interface{}) {
+	datas, ok := mongodb.Find("user", map[string]interface{}{
+		"i_appid": 2,
+		"$or": []map[string]interface{}{
+			map[string]interface{}{"s_phone": phone},
+			map[string]interface{}{"s_m_phone": phone},
+		},
+	}, `{"s_phone":-1}`, `{"_id":1}`, false, 0, 1)
+	if !ok {
+		return false, nil, nil
+	}
+	if datas == nil || len(*datas) == 0 {
+		return false, nil, nil
+	}
+	return FindUserAndCreateSessById((*datas)[0]["_id"].(bson.ObjectId), session)
+}

+ 0 - 22
src/jfw/front/otherAct.go

@@ -2,7 +2,6 @@ package front
 
 
 import (
 import (
 	"fmt"
 	"fmt"
-	"net/http"
 	"qfw/util"
 	"qfw/util"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"regexp"
 	"regexp"
@@ -139,7 +138,6 @@ func (f *Front) Lpsubmit() error {
 					"i_ratemode":   2,
 					"i_ratemode":   2,
 					"l_modifydate": time.Now().Unix(),
 					"l_modifydate": time.Now().Unix(),
 				},
 				},
-				"o_log": reqPhoneInfo(f.Request),
 			}
 			}
 			_id := mongodb.Save("user", data)
 			_id := mongodb.Save("user", data)
 			if _id != "" {
 			if _id != "" {
@@ -170,23 +168,3 @@ func deleteIdentSession(session *httpsession.Session) {
 	session.Del("lastSendMsgTime")
 	session.Del("lastSendMsgTime")
 
 
 }
 }
-
-//获取保存用户日志
-func reqPhoneInfo(req *http.Request) map[string]interface{} {
-	return map[string]interface{}{
-		"s_ip":       req.Proto,
-		"s_describe": req.Form,
-		"s_client":   req.Header.Get("user-agent"),
-		"s_method":   req.Method,
-	}
-}
-
-//用户是否存在
-func userIsExists(phoneNum string) bool {
-	query := map[string]interface{}{
-		"s_phone": phoneNum,
-		"i_appid": 2,
-	}
-	count := mongodb.Count("user", query)
-	return count > 0
-}

+ 0 - 1
src/jfw/front/pchelper.go

@@ -133,7 +133,6 @@ func (l *PcHelper) Login() error {
 								"i_ratemode":   2,
 								"i_ratemode":   2,
 								"l_modifydate": time.Now().Unix(),
 								"l_modifydate": time.Now().Unix(),
 							},
 							},
-							"o_log": reqPhoneInfo(l.Request),
 						}
 						}
 						_id := mongodb.Save("user", data)
 						_id := mongodb.Save("user", data)
 						if _id != "" {
 						if _id != "" {

+ 1 - 1
src/jfw/front/swordfish.go

@@ -115,7 +115,7 @@ func (m *Front) NewSordfish() error {
 		m.T["avatar"] = util.ObjToString(m.GetSession("s_avatar"))
 		m.T["avatar"] = util.ObjToString(m.GetSession("s_avatar"))
 		return m.Render("/pc/mobileindex.html", &m.T)
 		return m.Render("/pc/mobileindex.html", &m.T)
 	} else {
 	} else {
-		if ret := redis.Get("other", "jypcindex"); ret != nil {
+		if ret := redis.Get("other", "jypcindex"); ret != nil && false {
 			return m.SetBody([]byte(ret.(string)))
 			return m.SetBody([]byte(ret.(string)))
 		} else {
 		} else {
 			m.DisableHttpCache()
 			m.DisableHttpCache()

+ 4 - 20
src/jfw/front/websocket.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"encoding/json"
 	"fmt"
 	"fmt"
 	"log"
 	"log"
+
 	//"net/http"
 	//"net/http"
 	"jfw/config"
 	"jfw/config"
 	qutil "qfw/util"
 	qutil "qfw/util"
@@ -151,29 +152,12 @@ func LoginInfo(shareid, openid string, Sess interface{}) (infoData map[string]in
 		return nil
 		return nil
 	}
 	}
 	sess, _ := Sess.(*httpsession.Session)
 	sess, _ := Sess.(*httpsession.Session)
-	infoData = make(map[string]interface{})
 	if openid != "" {
 	if openid != "" {
-		sess.Set("openid", openid)
-		redisheadimg := redis.Get("other", "newUser-"+openid)
-		if redisheadimg == nil {
-			redisheadimg = ""
-		}
-		user, _ := mongodb.FindOneByField("user", `{"s_m_openid":"`+openid+`"}`, `{"s_nickname":1,"s_headimage":1,"s_m_openid":1,"_id":1}`)
-		if user != nil && len(*user) > 0 {
-			infoData["result"] = "ok"
-			infoData["s_nickname"] = fmt.Sprint((*user)["s_nickname"])
-			infoData["s_headimage"] = fmt.Sprint((*user)["s_headimage"])
-			infoData["redisheadimg"] = fmt.Sprint(redisheadimg)
-			infoData["encryptId"] = se.EncodeString(qutil.BsonIdToSId((*user)["_id"]))
-			infoData["shareid"] = shareid
-			infoData["openid"] = se.EncodeString(fmt.Sprint((*user)["s_m_openid"])) //add 20181116
+		ok, user, infoData := FindUserAndCreateSess(openid, sess)
+		if ok {
 			(*user)["shareid"] = shareid
 			(*user)["shareid"] = shareid
-			nick := fmt.Sprint((*user)["s_nickname"])
-			sess.Set("nickname", nick)
-			sess.Set("s_nickname", nick)
-			sess.Set("s_m_openid", fmt.Sprint((*user)["s_m_openid"]))
 			sess.Set("user", *user)
 			sess.Set("user", *user)
-			sess.Set("userId", qutil.BsonIdToSId((*user)["_id"]))
+			infoData["shareid"] = shareid
 			sess.Set("rpcBackUserInfo", infoData)
 			sess.Set("rpcBackUserInfo", infoData)
 		}
 		}
 	}
 	}

+ 1 - 0
src/seo.json

@@ -422,6 +422,7 @@
     "dataexport": "23",
     "dataexport": "23",
     "baiduSEM-p": "24",
     "baiduSEM-p": "24",
     "course": "25",
     "course": "25",
+    "wjmm": "26",
     "module": {
     "module": {
         "subscribe": "订阅页",
         "subscribe": "订阅页",
         "/list/": "标签页",
         "/list/": "标签页",

+ 390 - 8
src/web/staticres/css/pc.css

@@ -109,9 +109,6 @@ form{
 }
 }
 
 
 /***************登录*************************/
 /***************登录*************************/
-.bidLogin .modal-dialog{
-	width: 465px;
-}
 .bidLogin .modal-body>img{
 .bidLogin .modal-body>img{
 	width: 180px;
 	width: 180px;
 	height: 180px;
 	height: 180px;
@@ -2872,10 +2869,6 @@ form{
 	display: inline-block;
 	display: inline-block;
 }
 }
 /*******剑鱼标讯*******/
 /*******剑鱼标讯*******/
-
-#bidLogin .modal-dialog {
-	width:auto;
-}
 .modal-header {
 .modal-header {
 	border-bottom:0px;
 	border-bottom:0px;
 	padding: 40px 34px 0px;
 	padding: 40px 34px 0px;
@@ -2888,7 +2881,6 @@ form{
 	float:left;
 	float:left;
 	border-right: 1px solid #e5e5e5;
 	border-right: 1px solid #e5e5e5;
 	width: 500px;
 	width: 500px;
-	height: 100%;
 	padding-top: 10px;
 	padding-top: 10px;
 	padding-right: 7px;
 	padding-right: 7px;
 }
 }
@@ -4089,4 +4081,394 @@ h6 {
 }
 }
 .fontcolor{
 .fontcolor{
 	color:#fff;
 	color:#fff;
+}
+/******************2020/05/20 pc端手机号登陆******************/
+.login-dig-success-toast {
+  display: none;
+  flex-direction: column;
+  align-items: center;
+  padding: 24px 40px;
+  position: absolute;
+  z-index: 668;
+  width: 144px;
+  height: 140px;
+  top: 50%;
+  margin-top: -70px;
+  left: calc(50% - 72px);
+  box-sizing: border-box;
+  background: rgba(0, 0, 0, 0.65);
+  border-radius: 12px;
+  font-size: 16px;
+  line-height: 24px;
+  color: #FFFFFF;
+}
+
+.login-dig-success-toast.is-show {
+  display: flex;
+}
+
+.login-dig-success-toast i {
+  width: 56px;
+  height: 56px;
+  margin-bottom: 14px;
+}
+
+.login-dig-mask {
+  display: none;
+  position: fixed;
+  z-index: 666;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: #000;
+  opacity: 0.6;
+}
+
+.login-dig-mask.is-show {
+  display: block;
+}
+
+.login-dig-box {
+  display: none;
+  background: #fff;
+  z-index: 667;
+  position: absolute;
+  width: 376px;
+  top: 50%;
+  margin-top: -282px;
+  left: calc(50vw - 188px);
+  padding: 32px 48px;
+  box-sizing: border-box;
+  border-radius: 16px;
+  font-family: Microsoft YaHei;
+}
+
+.login-dig-box.is-show {
+  display: block;
+}
+
+.login-dig-box .logo {
+  width: 96px;
+  height: 25px;
+}
+
+.login-dig-tabbar-navbar {
+  margin-top: 32px;
+  padding-bottom: 12px;
+}
+
+.login-dig-tabbar-navbar span {
+  color: #999;
+  font-size: 16px;
+  line-height: 24px;
+  cursor: pointer;
+}
+
+.login-dig-tabbar-navbar span + span {
+  margin-left: 24px;
+}
+
+.login-dig-tabbar-navbar span.is-active {
+  color: #1D1D1D;
+}
+
+.login-dig-tabbar-navbar .line-box {
+  margin-top: 8px;
+  width: 80px;
+  height: 3px;
+  background: #2CB7CA;
+  transition: all 0.33s;
+}
+
+.login-dig-tabbar-navbar span.is-active + span + .line-box {
+  transform: none;
+}
+
+.login-dig-tabbar-navbar span + span.is-active + .line-box {
+  transform: translateX(104px);
+}
+
+.login-dig-tabbar-content {
+  display: none;
+}
+
+.login-dig-tabbar-content.is-active {
+  display: block;
+}
+
+.login-dig-submit-button {
+  margin-top: 12px;
+  cursor: pointer;
+  width: 280px;
+  height: 44px;
+  background: #2CB7CA;
+  border-radius: 63px;
+  font-size: 16px;
+  line-height: 24px;
+  color: #fff;
+  outline: none;
+  border: 1px solid #2CB7CA;
+}
+
+.login-dig-submit-button:disabled {
+  border-color: #E0E0E0;
+  background: #E0E0E0;
+  cursor: not-allowed;
+}
+
+.login-dig-input-box {
+  margin-top: 12px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: 280px;
+  height: 44px;
+  color: #1D1D1D;
+  font-size: 14px;
+  background: #F3F6F7;
+  border-radius: 20px;
+  padding: 0 16px;
+  box-sizing: border-box;
+  border: 1px solid #F3F6F7;
+  position: relative;
+}
+
+.login-dig-input-box.is-focus {
+  border-color: #2CB7CA;
+}
+
+.login-dig-input-box.is-error {
+  border-color: #FF3A20;
+  margin-bottom: 36px;
+}
+
+.login-dig-input-box.is-error::after {
+  content: attr(data-error);
+  position: absolute;
+  bottom: -24px;
+  left: 8px;
+  color: #FF3A20;
+  font-size: 14px;
+  line-height: 20px;
+}
+
+.login-dig-input-box input {
+  width: 100%;
+  height: 90%;
+  margin-left: 8px;
+  background: inherit;
+  color: inherit;
+  font-size: inherit;
+  border: none;
+  outline: none;
+}
+
+.login-dig-input-box input::placeholder {
+  color: #999;
+}
+
+.login-dig-input-box input:focus {
+  border: none;
+}
+
+.login-dig-input-box .after-input-box {
+  position: absolute;
+  cursor: pointer;
+  height: 100%;
+  top: 0;
+  right: 16px;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  color: #999999;
+}
+
+.login-dig-input-box .after-input-box .verify-img {
+  border-radius: 20px;
+  margin-right: -14px;
+}
+
+.login-dig-footer-box {
+  font-size: 12px;
+  line-height: 20px;
+  color: #999999;
+}
+
+.login-dig-footer-box p {
+  margin-top: 32px;
+}
+
+.login-dig-footer-box a {
+  color: inherit !important;
+  text-decoration: none;
+  font-size: 12px;
+}
+
+.login-dig-wx-qrcode-box {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.login-dig-wx-qrcode-box .wx-qrcode {
+  max-width: 200px;
+  max-width: 200px;
+}
+
+.login-dig-wx-qrcode-box .wx-tip {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: center;
+  padding: 4px 20px;
+  box-sizing: border-box;
+  width: 152px;
+  height: 32px;
+  background: rgba(44, 183, 202, 0.08);
+  border-radius: 52px;
+  font-size: 14px;
+  line-height: 24px;
+  color: #2CB7CA;
+}
+
+.login-dig-wx-qrcode-box .wx-tip .wx-logo {
+  width: 20px;
+  height: 20px;
+  margin-right: 8px;
+}
+
+.login-dig-text-split {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: center;
+  font-size: 12px;
+  line-height: 20px;
+  color: #999999;
+  margin-top: 32px;
+}
+
+.login-dig-text-split span {
+  margin: 0 4px;
+}
+
+.login-dig-text-split i {
+  width: 30px;
+  height: 1px;
+  background: #999;
+}
+
+.login-dig-top-back-box {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  font-size: 14px;
+  line-height: 24px;
+  color: #686868;
+  cursor: pointer;
+  margin-bottom: 32px;
+}
+
+.login-dig-top-back-box span {
+  margin-left: 8px;
+}
+
+.login-dig-icon-phone {
+  background: url("/images/phonelogin/icon-phone.png");
+  background-size: 18px 18px;
+  width: 18px;
+  height: 18px;
+  display: inline-block;
+}
+
+.login-dig-icon-pass {
+  background: url("/images/phonelogin/icon-pass.png");
+  background-size: 18px 18px;
+  width: 18px;
+  height: 18px;
+  display: inline-block;
+}
+
+.login-dig-icon-guard {
+  background: url("/images/phonelogin/icon-guard.png");
+  background-size: 18px 18px;
+  width: 18px;
+  height: 18px;
+  display: inline-block;
+}
+
+.login-dig-icon-back {
+  background: url("/images/phonelogin/back.png");
+  background-size: 24px 24px;
+  width: 24px;
+  height: 24px;
+  display: inline-block;
+}
+
+.login-dig-icon-wx {
+  background: url("/images/phonelogin/wx.png");
+  background-size: 100% 100%;
+  width: 100%;
+  height: 100%;
+  display: inline-block;
+}
+
+.login-dig-icon-success {
+  background: url("/images/phonelogin/success.png");
+  background-size: 100% 100%;
+  width: 100%;
+  height: 100%;
+  display: inline-block;
+}
+
+.login-dig-icon-close {
+  background: url("/images/phonelogin/close.png");
+  background-size: 20px 20px;
+  position: absolute;
+  width: 20px;
+  height: 20px;
+  right: 16px;
+  top: 16px;
+  transition: all .2s;
+  cursor: pointer;
+}
+
+.login-dig-icon-close:hover {
+  transform: scale(1.1);
+}
+
+.wx-logo-box {
+  cursor: pointer;
+  width: 40px;
+  height: 40px;
+  margin: 0 auto;
+  margin-top: 8px;
+  background: rgba(44, 183, 202, 0.12);
+  border-radius: 96px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+}
+
+.wx-logo-box .wx-logo {
+  width: 24px;
+  height: 24px;
+}
+
+.right-box {
+  margin-top: 12px;
+  text-align: right;
+}
+
+.forget-pass-link {
+  font-size: 13px;
+  line-height: 20px;
+  color: #686868 !important;
+  text-decoration: none;
+}
+
+.is-stop {
+  cursor: not-allowed;
 }
 }

BIN
src/web/staticres/images/phonelogin/back.png


BIN
src/web/staticres/images/phonelogin/close.png


BIN
src/web/staticres/images/phonelogin/icon-guard.png


BIN
src/web/staticres/images/phonelogin/icon-pass.png


BIN
src/web/staticres/images/phonelogin/icon-phone.png


BIN
src/web/staticres/images/phonelogin/success.png


BIN
src/web/staticres/images/phonelogin/test.png


BIN
src/web/staticres/images/phonelogin/wx.png


+ 3 - 2
src/web/staticres/js/login.js

@@ -517,14 +517,15 @@ var signout = function(){
 			}catch(e){
 			}catch(e){
 				document.cookie = "userid_secure=;expires=-1;path=/";
 				document.cookie = "userid_secure=;expires=-1;path=/";
 			}
 			}
-            var pt = new RegExp("^/front/dataExport/.+$|^/front/course/codePay$|^/front/course/orderPay$");
+			window.location.href="/";
+            /*var pt = new RegExp("^/front/dataExport/.+$|^/front/course/codePay$|^/front/course/orderPay$");
             if(pt.test(window.location.pathname)){
             if(pt.test(window.location.pathname)){
                 window.location.href="/";
                 window.location.href="/";
             }else{
             }else{
 				LoginPolling.start();
 				LoginPolling.start();
 				createWebSocket(false);
 				createWebSocket(false);
 				getNewShareId(mynum);
 				getNewShareId(mynum);
-			}
+			}*/
 		}
 		}
 	})
 	})
 }
 }

+ 1 - 1
src/web/staticres/js/proproject.js

@@ -388,7 +388,7 @@ function noIn(p){
 		}
 		}
 		window.open("/article/content/"+thisId+aHref);
 		window.open("/article/content/"+thisId+aHref);
 	}else{
 	}else{
-		$('#myModal').modal("show");
+		$('#bidLogin').modal("show");
 	}
 	}
 }
 }
 //
 //

+ 3 - 0
src/web/templates/common/go.mod

@@ -0,0 +1,3 @@
+module src
+
+go 1.14

+ 664 - 22
src/web/templates/common/pchead.html

@@ -57,20 +57,73 @@
 </section>
 </section>
 
 
 <div class="modal fade bidLogin" id="bidLogin"  tabindex="-1" role="dialog" aria-labelledby="bidLogin" aria-hidden="true" >
 <div class="modal fade bidLogin" id="bidLogin"  tabindex="-1" role="dialog" aria-labelledby="bidLogin" aria-hidden="true" >
-  <div class="modal-dialog" style="width:400px;border:0px;" >
-		<div class="j-wx-code">
-			<img class="code-close" src="{{Msg "seo" "cdn"}}/images/j-wx-code-close.png" alt="" onclick="loginClose();"/>
-			<div class="code-title"></div>
-			<div class="code-wxm"><img id="layerImg-login" src="/front/share/10"/></div>
-			<div class="code-text">
-				<span><img id="wxpng" src="{{Msg "seo" "cdn"}}/images/wx1.png"/>微信扫码登录</span>
-				<br/>
-				<span id="freetext">新用户自动注册</span>
-			</div>
-			<div class="code-bottom">
-				<img src="{{Msg "seo" "cdn"}}/images/j-wx-cose-move.png" alt=""/>
-			</div>
-		</div>
+  <div class="modal-dialog login-dig-box is-show" style="width:376px;">
+      <div class="login-dig-icon-close" onclick="closeLoginDig()"></div>
+      <img class="logo" src="/images/swordfish/sf_01_new.png" alt="logo" style="">
+      <div class="login-dig-top-back-box" style="display: none;" onclick="openLoginDigForWx(false)">
+          <i class="login-dig-icon-back"></i>
+          <span>验证码/密码登录</span>
+      </div>
+      <div class="login-dig-tabbar-navbar" style="">
+          <span name="code" class="is-active">验证码登录</span>
+          <span name="pass" class="">密码登录</span>
+          <div class="line-box"></div>
+      </div>
+      <div class="login-dig-tabbar-content is-active" data-name="code" style="">
+          <div class="login-dig-input-box" data-error="手机号码输入错误">
+              <i class="login-dig-icon-phone"></i>
+              <input autocomplete="off" name="verify_phone" type="tel" placeholder="输入手机号码" maxlength="11">
+          </div>
+          <div class="login-dig-input-box" data-error="图形验证码输入错误">
+              <i class="login-dig-icon-guard"></i>
+              <input autocomplete="off" name="verify_code" type="text" placeholder="输入图形验证码" maxlength="8">
+              <div class="after-input-box">
+                  <img data-name="verfiy-login" class="verify-img" src="/front/landpage/captcha" alt="verify">
+              </div>
+          </div>
+          <div class="login-dig-input-box" data-error="短信验证码输入错误">
+              <i class="login-dig-icon-guard"></i>
+              <input autocomplete="off" name="verify_sms" type="text" placeholder="输入短信验证码" maxlength="8">
+              <div class="after-input-box">
+                  <span data-name="verify_get_sms" class="l-get-sms is-stop">获取验证码</span>
+              </div>
+          </div>
+          <button class="login-dig-submit-button" name="verify_submit" disabled="true">登录 / 注册</button>
+      </div>
+      <div class="login-dig-tabbar-content" data-name="pass">
+          <div class="login-dig-input-box" data-error="手机号码输入错误">
+              <i class="login-dig-icon-phone"></i>
+              <input autocomplete="off" name="pass_phone" type="tel" placeholder="输入手机号码" maxlength="11">
+          </div>
+          <div class="login-dig-input-box" data-error="密码输入错误">
+              <i class="login-dig-icon-pass"></i>
+              <input autocomplete="off" name="pass_pass" type="password" placeholder="输入密码">
+          </div>
+          <button class="login-dig-submit-button" name="pass_submit" disabled="true">登录</button>
+          <div class="right-box">
+              <a class="forget-pass-link" href="/phone/forgetPwd">忘记密码?</a>
+          </div>
+      </div>
+      <div class="login-dig-wx-qrcode-box" style="display: none;">
+          <img class="wx-qrcode" id="layerImg-login" src="/front/share/10"/>
+          <div class="wx-tip">
+              <div class="wx-logo"><i class="login-dig-icon-wx"></i></div>
+              <span>微信扫码登录</span>
+          </div>
+      </div>
+      <div class="login-dig-footer-box">
+          <div class="login-dig-text-split" style="">
+              <i></i><span>使用微信扫码登录</span><i></i>
+          </div>
+          <div class="wx-logo-box" onclick="openLoginDigForWx(true)" style="">
+              <div class="wx-logo"><i class="login-dig-icon-wx"></i></div>
+          </div>
+          <p>
+              未注册用户验证后自动注册,注册即代表同意
+              <a href="/front/staticPage/permission_rules.html">《剑鱼标讯用户使用许可协议》</a>
+              <a href="/front/staticPage/privacy_rules.html">《剑鱼标讯隐私政策》</a>
+          </p>
+      </div>
   </div>
   </div>
 </div>
 </div>
 <script type="text/javascript">
 <script type="text/javascript">
@@ -78,18 +131,15 @@
 $(function(){
 $(function(){
 	//
 	//
 	var href = window.location.pathname;
 	var href = window.location.pathname;
-	$("#bidLogin").on("show.bs.modal", function () {
-		$("#freetext").html("<span><em style='color: #252627;line-height: 26px;'> 新用户自动注册</em><br><span class='new-info'><a class='link' href='/front/staticPage/permission_rules.html'>《剑鱼标讯用户使用许可协议》</a><a class='link' href='/front/staticPage/privacy_rules.html'>《剑鱼标讯隐私政策》</a></span>  </span>");
-		if(href!="/"){
-			//$(".public-nav").css({"padding-right":"17px"});
-		}
-	})
+  $("#bidLogin").on("show.bs.modal", function () {
+		$("#bidLogin .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());
+	});
 	$("#bidLogin").on("hidden.bs.modal", function () {
 	$("#bidLogin").on("hidden.bs.modal", function () {
 		$(".public-nav").css({"padding-right":""});
 		$(".public-nav").css({"padding-right":""});
 		if($("#bidLogin").attr("data-rec")){
 		if($("#bidLogin").attr("data-rec")){
-            $("#bidLogin").removeAttr("data-rec");
+      $("#bidLogin").removeAttr("data-rec");
 		}
 		}
-	})
+	});
 	$("#myModal").on("show.bs.modal", function () {
 	$("#myModal").on("show.bs.modal", function () {
 		//$(".public-nav").css({"padding-right":"17px"});
 		//$(".public-nav").css({"padding-right":"17px"});
 	})
 	})
@@ -230,4 +280,596 @@ function infoListCss(){
 function loginClose(){
 function loginClose(){
 	$("#bidLogin").modal("hide");
 	$("#bidLogin").modal("hide");
 }
 }
+
+function openLoginDigForWx (type = true) {
+    var otherArr = ['.login-dig-box > .logo','.login-dig-footer-box .wx-logo-box', '.login-dig-footer-box .login-dig-text-split' ,'.login-dig-tabbar-navbar', '.login-dig-tabbar-content', '.login-dig-tabbar-content.is-active']
+    var wxArr = ['.login-dig-wx-qrcode-box', '.login-dig-top-back-box']
+
+    otherArr.forEach(function (v) {
+        document.querySelector(v).style.display = (type ? 'none' : null)
+    })
+    wxArr.forEach(function (v) {
+        document.querySelector(v).style.display = (type ? null : 'none')
+    })
+}
+
+// ajax部分匿名函数自执行,防止泄露全局变量
+$(function(){
+    var Direct = {
+        verify: {},
+        forge: {},
+        ajaxSms (e, type) {
+            var _this = this;
+            if (type === 'verify') {
+                $.post("/phone/login",{
+                  reqType:"sendIdentCode",
+                  phone:$("#bidLogin .login-dig-input-box [name='verify_phone']").val(),
+                  code:$("#bidLogin .login-dig-input-box [name='verify_code']").val()
+                },function(r){
+                  if(r.status==-1){
+                    _this.verify.code.showError('手机号格式错误');
+                  }else if(r.status==-2){//图形验证码错误
+                    _this.verify.code.showError('图形验证码错误');
+                    $("#bidLogin .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());                    
+                  }else{
+                    sessionStorage.setItem('login-verify-start-time', new Date().getTime())
+                    startTimeDown(type)
+                  }
+                });
+            } else {
+              $.post("/phone/forgetPwd",{
+                  reqType:"sendIdentCode",
+                  phone:$(".forgetpwd_page .login-dig-input-box [name='forge_phone']").val(),
+                  code:$(".forgetpwd_page .login-dig-input-box [name='forge_code']").val()
+                },function(r){
+                  if(r.status=="phoneError"){
+                    _this.forge.code.showError('手机号格式错误');
+                  }else if(r.status=="codeError"){
+                    _this.forge.code.showError('图形验证码输入错误');
+                    $(".forgetpwd_page .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());                    
+                  }else if(r.status=="phoneNotExists"){
+                    _this.forge.phone.showError('手机号尚未注册');
+                    $(".forgetpwd_page .verify-img").attr("src","/front/landpage/captcha?v="+new Date().getTime());                    
+                  }else if(r.status=="y"){
+                    sessionStorage.setItem('login-verify-start-time', new Date().getTime())
+                    startTimeDown(type)
+                  }
+                });
+            }
+        },
+        // 忘记密码
+        ajaxStepOne (e, arr) {
+            $.post("/phone/forgetPwd",{reqType:"nextStep",identCode:arr[2].value},function(r){
+              e.setAttribute('data-loading', 'false');
+              if(r.status=="identCodeError"){
+                arr[2].showError('短信验证码错误');
+              }else if(r.status=="y"){
+                toggleStep(false);
+              }
+            });
+        },
+        ajaxStepTwo (e, arr) {
+            $.post("/phone/forgetPwd",{reqType:"save",password:arr[1].value},function(r){
+              e.setAttribute('data-loading', 'false');
+              if(r.status=="passwordError"){
+                arr[0].showError('密码格式错误');
+              }else if(r.status=="passwordRepeat"){
+                arr[0].showError('新密码不能与之前设置过的密码重复');
+              }else{
+                var toast = document.querySelector('.login-dig-success-toast')
+                toast.classList.add('is-show')
+                setTimeout(function () {
+                    toast.classList.remove('is-show')
+                }, 1500);
+                window.location.href="/";
+              }
+            });
+        },
+        // 验证码/密码登录
+        ajaxLoginPass (e, arr) {
+            $.post("/phone/login",{reqType:"phoneLogin",phone:arr[0].value,password: arr[1].value},function(r){
+                e.setAttribute('data-loading', 'false')
+                if(r.status==1){
+                  logic(r.userInfo,mynum);
+                }else if(r.status==-1){
+                  arr[0].showError('该手机号未注册')
+                }else if(r.status==-2){
+                  arr[1].showError('密码输入错误')
+                }
+            });
+        },
+        ajaxLoginSms (e, arr) {
+            $.post("/phone/login",{reqType:"identCodeLogin",identCode:arr[2].value},function(r){
+              e.setAttribute('data-loading', 'false')
+              if(r.status==1){
+                logic(r.userInfo,mynum);
+              }
+            });
+        }
+    }
+    function startTimeDown (type) {
+        var nowCount = 60
+        if (sessionStorage.getItem('login-verify-start-time')) {
+            var cCount = parseInt((new Date().getTime() - sessionStorage.getItem('login-verify-start-time')) / 1000)
+            if (cCount >= 0 & cCount <= 60) {
+                nowCount -= cCount
+            } else {
+                sessionStorage.removeItem('login-verify-start-time')
+                return
+            }
+        } else {
+            return
+        }
+        var nowQ = 'span[data-name="verify_get_sms"]'
+        var otherQ = 'span[data-name="forge_get_sms"]'
+        if (type === 'forge') {
+            var tempQ = nowQ
+            nowQ = otherQ
+            otherQ = tempQ
+        }
+        var Ele = document.querySelector(nowQ)
+        var otherEle = document.querySelector(otherQ)
+        var defalutIT = '重新获取('+ --nowCount +'s)'
+        if (Ele) Ele.innerText = defalutIT
+        if (otherEle) otherEle.innerText = defalutIT
+        var nowSS = window.setInterval(function ()  {
+            if (nowCount === 1 || !sessionStorage.getItem('login-verify-start-time')) {
+                clearInterval(nowSS)
+                if (Ele) Ele.innerText = '获取验证码'
+                if (otherEle) otherEle.innerText = '获取验证码'
+                sessionStorage.removeItem('login-verify-start-time')
+                return
+            }
+            var iT = '重新获取('+ --nowCount +'s)'
+            if (Ele) Ele.classList.add('is-stop')
+            if (Ele)  Ele.innerText = iT
+            if (otherEle) otherEle.classList.add('is-stop')
+            if (otherEle)  otherEle.innerText = iT
+        }, 1000)
+    }
+    function getSMSCode (e) {
+        if (e.classList.contains('is-stop')) return
+        var verifyStartTime = new Date().getTime()
+        var oldTime = sessionStorage.getItem('login-verify-start-time') || verifyStartTime - 70000
+        if (verifyStartTime - oldTime >= 60000) {
+            var nowQ = e.getAttribute('data-name') === 'forge_get_sms' ? 'forge' : 'verify'
+            Direct.ajaxSms(e, nowQ)
+        }
+    }
+
+    // 表单规则
+    function ruleForPhone (data, type) {
+        var checkStatus = /^1[3|7|8]\d{9}$|^19[8-9]\d{8}$|^166\d{8}|^15[0-3|5-9]\d{8}|^14[5|7]\d{8}$/.test(data.value)
+        if (type === 'input') {
+            return data.value.length >= 11 ? checkStatus : true
+        }
+        if (type === 'blur') {
+            return data.value.length ? checkStatus : true
+        }
+        return checkStatus
+    }
+    function ruleForCode (data, type) {
+        var checkStatus = /^\S{4,}$/.test(data.value)
+        if (type === 'blur') {
+            return data.value.length ? checkStatus : true
+        }
+        if (type === 'input') {
+            return data.value.length >= 4 ? checkStatus : true
+        }
+        return checkStatus
+    }
+    function ruleForSms (data, type) {
+        var checkStatus = /^\S{4,}$/.test(data.value)
+        if (type === 'blur') {
+            return data.value.length ? checkStatus : true
+        }
+        if (type === 'input') {
+            return data.value.length >= 4 ? checkStatus : true
+        }
+        return checkStatus
+    }
+    function ruleForPass (data, type) {
+        var checkStatus = /^\S{6,}$/.test(data.value)
+        if (type === 'blur') {
+            return data.value.length ? checkStatus : true
+        }
+        if (type === 'input') {
+            return data.value.length >= 6 ? checkStatus : true
+        }
+        return checkStatus
+    }
+    function createFormStauts (formOption) {
+        var nowEle = document.querySelector(formOption.el)
+        var errClass = 'is-error'
+        // 实时状态
+        var nowData = {
+            status: null,
+            next: false,
+            value: null,
+            el: nowEle,
+            showError: function (error) {
+                this.status = false
+                this.next = false
+                formOption.upStatus()
+                if (error) {
+                    this.el.parentNode.setAttribute('data-error', error)
+                    this.el.parentNode.classList.add(errClass)
+                }
+            }
+        }
+        // 错误提示
+        if (formOption.errorTip && formOption.errorTip !== '') {
+            nowEle.parentNode.setAttribute('data-error', formOption.errorTip)
+        }
+        // 校验规则
+        if (typeof formOption.rule !== "function") {
+            formOption.rule = function (data) {
+                return true
+            }
+        }
+        // 状态变动通知回调
+        if (typeof formOption.upStatus !== "function") {
+            formOption.upStatus = function (data) {
+                return true
+            }
+        }
+        // 监听事件
+        formOption.event.forEach(function (event) {
+            if (nowEle) nowEle.addEventListener(event,function (e) {
+                // input
+                var nowTarget = e.target
+                var errorTarget = nowTarget.parentNode
+                // 移除错误提示
+                errorTarget.classList.remove(errClass)
+                // 更新状态
+                nowData.value = nowTarget.value
+                nowData.status = formOption.rule(nowData, event)
+                nowData.next = formOption.rule(nowData, 'next')
+                formOption.upStatus()
+                // 更新错误提示
+                if (nowData.status) {
+                    errorTarget.classList.remove(errClass)
+                } else {
+                    errorTarget.classList.add(errClass)
+                }
+            })
+        })
+        return nowData
+    }
+    // 事件
+    function installInputEvent () {
+        // verify img event for click
+        document.querySelectorAll('.login-dig-input-box .verify-img').forEach(function (v) {
+            v.addEventListener('click', function (e) {
+                e.target.src = '/front/landpage/captcha?v='+new Date().getTime();
+            })
+        })
+        // verify sms event for click
+        document.querySelectorAll('.login-dig-input-box .l-get-sms').forEach(function (v) {
+            v.addEventListener('click', function (e) {
+                getSMSCode(e.target)
+            })
+        })
+        // input event for focus
+        document.querySelectorAll('.login-dig-input-box input').forEach(function (v) {
+            v.addEventListener('focus', function (e) {
+                var nowInput = e.target
+                nowInput.parentNode.classList.add('is-focus')
+            })
+            v.addEventListener('blur', function (e) {
+                var nowInput = e.target
+                nowInput.parentNode.classList.remove('is-focus')
+            })
+        })
+    }
+    // E-公用
+
+    // 忘记密码
+    function toggleStep (type = true) {
+        var nowArr = ['.forget-form-box[data-step="1"]', '.forget-step-title[data-step="1"]']
+        var otherArr = ['.forget-form-box[data-step="2"]', '.forget-step-title[data-step="2"]']
+
+        otherArr.forEach(function (v) {
+            if (document.querySelector(v)) document.querySelector(v).style.display = (type ? 'none' : null)
+        })
+        nowArr.forEach(function (v) {
+            if (document.querySelector(v))  document.querySelector(v).style.display = (type ? null : 'none')
+        })
+    }
+    // 弹窗登录
+    function installAddEventListener () {
+        // tabbar toggle event
+        document.querySelector('.login-dig-tabbar-navbar').addEventListener('click', function (e) {
+            if (e.target.nodeName !== "SPAN") return
+            if (e.target.classList.contains('is-active')) {
+                return
+            }
+            var SelectName = e.target.getAttribute('name')
+            document.querySelector('.login-dig-tabbar-navbar span.is-active').classList.toggle('is-active')
+            e.target.classList.toggle('is-active')
+            // content toggle
+            document.querySelector('.login-dig-tabbar-content.is-active').classList.toggle('is-active')
+            document.querySelector('.login-dig-tabbar-content[data-name="'+ SelectName +'"]').classList.toggle('is-active')
+        })
+        installInputEvent()
+    }
+    // 初始化
+    function isCheckInit() {
+        return document.querySelector('button[name="forge_submit_phone"]')
+    }
+    function initDirect () {
+        // 初始化事件
+        installAddEventListener()
+        // 初始化倒计时
+        startTimeDown()
+        // 验证码登录
+        var verifySubmit = {
+            el: 'button[name="verify_submit"]',
+            arr: [],
+            init (arr) {
+                this.arr = arr
+                this.check()
+                var submitEle = document.querySelector(this.el)
+                submitEle.addEventListener('click', this.submit)
+            },
+            submit (e) {
+                var e = e.target
+                if (e.getAttribute('data-loading') === 'true') return
+                e.setAttribute('data-loading', 'true')
+                Direct.ajaxLoginSms(e, verifySubmit.arr)
+            },
+            check () {
+                var submitEle = document.querySelector(this.el)
+                var checkStauts = false
+                this.arr.forEach(function (data) {
+                    if (!data.next) {
+                        checkStauts = true
+                    }
+                })
+                if (checkStauts) {
+                    submitEle.setAttribute('disabled', checkStauts)
+                } else {
+                    submitEle.removeAttribute('disabled')
+                }
+            }
+        }
+        var verifySendSms = {
+            el: '.login-dig-input-box span[data-name="verify_get_sms"]',
+            update (type) {
+                var Ele = document.querySelector(this.el)
+                if (type) {
+                    Ele.classList.remove('is-stop')
+                } else {
+                    Ele.classList.add('is-stop')
+                }
+            }
+        }
+        var verifyPhone = createFormStauts({
+            el: '.login-dig-input-box input[name="verify_phone"]',
+            rule: ruleForPhone,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+                verifySendSms.update(verifyCode.next && verifyPhone.next)
+            }
+        })
+        var verifyCode = createFormStauts({
+            el: '.login-dig-input-box input[name="verify_code"]',
+            rule: ruleForCode,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+                verifySendSms.update(verifyCode.next && verifyPhone.next)
+            }
+        })
+        var verifySms = createFormStauts({
+            el: '.login-dig-input-box input[name="verify_sms"]',
+            rule: ruleForSms,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+            }
+        })
+        verifySubmit.init([verifyPhone, verifyCode, verifySms])
+        verifySendSms.update(verifyCode.next && verifyPhone.next)
+
+        // 密码登录
+        var passSubmit = {
+            el: 'button[name="pass_submit"]',
+            arr: [],
+            init (arr) {
+                this.arr = arr
+                this.check()
+                var submitEle = document.querySelector(this.el)
+                submitEle.addEventListener('click', this.submit)
+            },
+            submit (e) {
+                var e = e.target
+                if (e.getAttribute('data-loading') === 'true') return
+                e.setAttribute('data-loading', 'true')
+                Direct.ajaxLoginPass(e, passSubmit.arr)
+            },
+            check () {
+                var submitEle = document.querySelector(this.el)
+                var checkStauts = false
+                this.arr.forEach(function (data) {
+                    if (!data.next) {
+                        checkStauts = true
+                    }
+                })
+                if (checkStauts) {
+                    submitEle.setAttribute('disabled', checkStauts)
+                } else {
+                    submitEle.removeAttribute('disabled')
+                }
+            }
+        }
+        var passPhone = createFormStauts({
+            el: '.login-dig-input-box input[name="pass_phone"]',
+            rule: ruleForPhone,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                passSubmit.check()
+            }
+        })
+        var passPass = createFormStauts({
+            el: '.login-dig-input-box input[name="pass_pass"]',
+            rule: ruleForPass,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                passSubmit.check()
+            }
+        })
+        passSubmit.init([passPhone, passPass])
+        Direct.verify = {
+            phone: verifyPhone,
+            code: verifyCode
+        }
+    }
+    function initForgetDirect () {
+        // 判断是否需要初始化
+        if (!isCheckInit()) return
+        // 初始化显示
+        toggleStep(true)
+        // 初始化倒计时
+        startTimeDown('forge')
+        // 手机验证
+        var verifySubmit = {
+            el: 'button[name="forge_submit_phone"]',
+            arr: [],
+            init (arr) {
+                this.arr = arr
+                this.check()
+                var submitEle = document.querySelector(this.el)
+                if (!submitEle) return
+                submitEle.addEventListener('click', this.submit)
+            },
+            submit (e) {
+                var e = e.target
+                if (e.getAttribute('data-loading') === 'true') return
+                e.setAttribute('data-loading', 'true')
+                Direct.ajaxStepOne(e, verifySubmit.arr)
+            },
+            check () {
+                var submitEle = document.querySelector(this.el)
+                if (!submitEle) return
+                var checkStauts = false
+                this.arr.forEach(function (data) {
+                    if (!data.next) {
+                        checkStauts = true
+                    }
+                })
+                if (checkStauts) {
+                    submitEle.setAttribute('disabled', checkStauts)
+                } else {
+                    submitEle.removeAttribute('disabled')
+                }
+            }
+        }
+        var verifySendSms = {
+            el: '.login-dig-input-box span[data-name="forge_get_sms"]',
+            update (type) {
+                var Ele = document.querySelector(this.el)
+                if (type) {
+                    Ele.classList.remove('is-stop')
+                } else {
+                    Ele.classList.add('is-stop')
+                }
+            }
+        }
+        var verifyPhone = createFormStauts({
+            el: '.login-dig-input-box input[name="forge_phone"]',
+            rule: ruleForPhone,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+                verifySendSms.update(verifyCode.next && verifyPhone.next)
+            }
+        })
+        var verifyCode = createFormStauts({
+            el: '.login-dig-input-box input[name="forge_code"]',
+            rule: ruleForCode,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+                verifySendSms.update(verifyCode.next && verifyPhone.next)
+            }
+        })
+        var verifySms = createFormStauts({
+            el: '.login-dig-input-box input[name="forge_sms"]',
+            rule: ruleForSms,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                verifySubmit.check()
+            }
+        })
+        verifySubmit.init([verifyPhone, verifyCode, verifySms])
+        verifySendSms.update(verifyCode.next && verifyPhone.next)
+
+        // 密码重置
+        var passSubmit = {
+            el: 'button[name="forge_submit_pass"]',
+            arr: [],
+            init (arr) {
+                this.arr = arr
+                this.check()
+                var submitEle = document.querySelector(this.el)
+                submitEle.addEventListener('click', this.submit)
+            },
+            submit (e) {
+                var e = e.target
+                if (e.getAttribute('data-loading') === 'true') return
+                e.setAttribute('data-loading', 'true')
+                Direct.ajaxStepTwo(e, passSubmit.arr)
+            },
+            check () {
+                var submitEle = document.querySelector(this.el)
+                var checkStauts = false
+                this.arr.forEach(function (data) {
+                    if (!data.next) {
+                        checkStauts = true
+                    }
+                })
+                if (checkStauts) {
+                    submitEle.setAttribute('disabled', checkStauts)
+                } else {
+                    if (this.arr[0].value !== this.arr[1].value) {
+                        this.arr[1].showError('两次密码输入不一致')
+                    } else {
+                        submitEle.removeAttribute('disabled')
+                    }
+                }
+            }
+        }
+        var passPhone = createFormStauts({
+            el: '.login-dig-input-box input[name="forge_pass_one"]',
+            rule: ruleForPass,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                passSubmit.check()
+            }
+        })
+        var passPass = createFormStauts({
+            el: '.login-dig-input-box input[name="forge_pass_two"]',
+            rule: ruleForPass,
+            event: ['input', 'blur'],
+            upStatus: function () {
+                passSubmit.check()
+            }
+        })
+        passSubmit.init([passPhone, passPass])
+
+        Direct.forge = {
+            phone: verifyPhone,
+            code: verifyCode
+        }
+    }
+    // 初始化弹窗
+    initDirect()
+    // 初始化忘记密码
+    initForgetDirect()
+});
+function closeLoginDig () {
+    $("#bidLogin").modal("hide");
+}
 </script>
 </script>

+ 118 - 0
src/web/templates/login/forgetPwd.html

@@ -0,0 +1,118 @@
+<html>
+<head>
+<title>忘记密码</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
+<meta name="renderer" content="webkit">
+<meta content="telephone=no" name="format-detection"/>
+{{include "/common/pnc.html"}}
+<link href="{{Msg "seo" "cdn"}}/css/pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+<link href="{{Msg "seo" "cdn"}}/css/dev2/reset_pc.css?v={{Msg "seo" "version"}}" rel="stylesheet">
+<script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js"></script>
+<link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/pccss/public-nav.css?v={{Msg "seo" "version"}}" />
+<link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/pccss/public-nav-1200.css?v={{Msg "seo" "version"}}" />
+<script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/public-nav.js?v={{Msg "seo" "version"}}"></script>
+</head>
+<style>
+.public-nav{
+  border-bottom: 1px solid #e0e0e0;
+}
+.forgetpwd_page{
+  padding-top:76px;
+}
+.forgetpwd_page>.login-dig-forget-pass-box{
+  margin: 20px 0px 50px 0px;
+}
+.login-dig-forget-pass-box {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  font-family: Microsoft YaHei;
+}
+
+.login-dig-forget-pass-box .forget-step-title {
+  font-size: 14px;
+  line-height: 24px;
+  color: #999999;
+}
+
+.login-dig-forget-pass-box .forget-step-title div {
+  color: #1D1D1D;
+  font-size: 24px;
+  line-height: 36px;
+  text-align: left;
+  min-width: 340px;
+}
+
+.login-dig-forget-pass-box .forget-form-box {
+  margin-top: 32px;
+}
+
+.login-dig-forget-pass-box .forget-form-box .login-dig-input-box {
+  width: 340px;
+}
+
+.login-dig-forget-pass-box .forget-form-box button {
+  width: 340px;
+  margin-top: 32px;
+}
+</style>
+<body>
+{{include "/common/pchead.html"}}
+<section class="forgetpwd_page">
+  <div class="login-dig-success-toast">
+      <i class="login-dig-icon-success"></i>
+      <span>修改成功</span>
+  </div>
+  <div class="login-dig-forget-pass-box">
+      <div class="forget-step-title" data-step="1">
+          <div>忘记密码</div>
+      </div>
+      <div class="forget-form-box" data-step="1">
+          <div class="login-dig-input-box" data-error="手机号码输入错误">
+              <i class="login-dig-icon-phone"></i>
+              <input autocomplete="off" name="forge_phone" type="tel" placeholder="输入手机号码" maxlength="11">
+          </div>
+          <div class="login-dig-input-box" data-error="图形验证码输入错误">
+              <i class="login-dig-icon-guard"></i>
+              <input autocomplete="off" name="forge_code" type="text" placeholder="输入图形验证码" maxlength="8">
+              <div class="after-input-box">
+                  <img class="verify-img" src="/front/landpage/captcha" alt="verify">
+              </div>
+          </div>
+          <div class="login-dig-input-box" data-error="短信验证码输入错误">
+              <i class="login-dig-icon-guard"></i>
+              <input autocomplete="off" name="forge_sms" type="text" placeholder="输入短信验证码" maxlength="8">
+              <div class="after-input-box">
+                  <span data-name="forge_get_sms" class="l-get-sms is-stop">获取验证码</span>
+              </div>
+          </div>
+          <button class="login-dig-submit-button" name="forge_submit_phone" disabled="true">下一步</button>
+      </div>
+      <div class="forget-step-title" data-step="2" style="display: none">
+          <div>设置新密码</div>
+          <span>新密码不少于6位,且不可与之前设置过的密码重复。</span>
+      </div>
+      <div class="forget-form-box" data-step="2" style="display: none">
+          <div class="login-dig-input-box" data-error="密码输入错误">
+              <i class="login-dig-icon-pass"></i>
+              <input autocomplete="off" name="forge_pass_one" type="password" placeholder="输入密码">
+          </div>
+          <div class="login-dig-input-box" data-error="密码输入错误">
+              <i class="login-dig-icon-pass"></i>
+              <input autocomplete="off" name="forge_pass_two" type="password" placeholder="确定密码">
+          </div>
+          <button class="login-dig-submit-button" name="forge_submit_pass" disabled="true">修改密码</button>
+      </div>
+  </div>
+</section>
+{{include "/common/pcbottom.html"}}
+{{include "/common/baiducc.html"}}
+<script type="text/javascript">
+var myPageNavIsNormal = true;
+$(function(){
+  $(".logo img").attr("src","{{Msg "seo" "cdn"}}/images/swordfish/sf_01_new.png");
+	haslogin({{.T.logid}});
+});
+</script>
+</body>
+</html>

+ 1 - 1
src/web/templates/pc/biddingsearch_enterprise.html

@@ -1497,7 +1497,7 @@
 			}
 			}
 			window.open("/article/content/"+thisId+aHref);
 			window.open("/article/content/"+thisId+aHref);
 		}else{
 		}else{
-			$('#myModal').modal("show");
+			$('#bidLogin').modal("show");
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
src/web/templates/pc/bidsearch.html

@@ -896,7 +896,7 @@ function noIn(p){
 		}
 		}
 		window.open("/article/content/"+thisId+aHref);
 		window.open("/article/content/"+thisId+aHref);
 	}else{
 	}else{
-		$('#myModal').modal("show");
+		$('#bidLogin').modal("show");
 		//setLogin(15);
 		//setLogin(15);
 	}
 	}
 }
 }

+ 1 - 1
src/web/templates/pc/bidsearch_static.html

@@ -705,7 +705,7 @@ function noIn(p){
 	if(loginflag){
 	if(loginflag){
 		window.open("/article/content/"+thisId+".html");
 		window.open("/article/content/"+thisId+".html");
 	}else{
 	}else{
-		$('#myModal').modal("show");
+		$('#bidLogin').modal("show");
 		//setLogin(15);
 		//setLogin(15);
 	}
 	}
 }
 }

+ 0 - 0
src/web/templates/pc/forgetPwd.html


+ 2 - 2
src/web/templates/pc/subscribe.html

@@ -525,7 +525,7 @@ $(function(){
 <button class="btn hidden" id="cb-01" data-toggle="modal" data-target="#myModal-01"></button>
 <button class="btn hidden" id="cb-01" data-toggle="modal" data-target="#myModal-01"></button>
 <div class="modal fade" id="myModal-01" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal fade" id="myModal-01" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
     <div class="modal-dialog">
     <div class="modal-dialog">
-        <div id="firstPopup" class="modal-content" style="width: 800px;margin: auto;height: 515px;">
+        <div id="firstPopup" class="modal-content" style="width: 845px;margin: auto;height: 515px;">
             <div class="modal-header">
             <div class="modal-header">
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
@@ -564,7 +564,7 @@ $(function(){
             <div class="modal-footer">
             <div class="modal-footer">
             </div>
             </div>
         </div><!-- /.modal-content -->
         </div><!-- /.modal-content -->
-    	<div id="secondPopup" class="modal-content hidden" style="width: 488px;margin: auto;height: 506px;">
+    	<div id="secondPopup" class="modal-content hidden" style="width: 505px;margin: auto;height: 506px;">
             <div class="modal-header">
             <div class="modal-header">
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">

+ 2 - 2
src/web/templates/pc/subscribe_new.html

@@ -131,7 +131,7 @@
 <!--免费订阅弹框-->
 <!--免费订阅弹框-->
 <div class="modal fade" id="myModal-01" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal fade" id="myModal-01" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
     <div class="modal-dialog">
     <div class="modal-dialog">
-        <div id="firstPopup" class="modal-content" style="width: 800px;margin: auto;height: 515px;">
+        <div id="firstPopup" class="modal-content" style="width: 845px;margin: auto;height: 515px;">
             <div class="modal-header">
             <div class="modal-header">
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
@@ -170,7 +170,7 @@
             <div class="modal-footer">
             <div class="modal-footer">
             </div>
             </div>
         </div><!-- /.modal-content -->
         </div><!-- /.modal-content -->
-        <div id="secondPopup" class="modal-content hidden" style="width: 488px;margin: auto;height: 506px;">
+        <div id="secondPopup" class="modal-content hidden" style="width: 505px;margin: auto;height: 506px;">
             <div class="modal-header">
             <div class="modal-header">
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">

+ 1 - 2
src/web/templates/pc/supsearch.html

@@ -1046,8 +1046,7 @@ function noIn(p){
 		}
 		}
 		window.open("/article/content/"+thisId+aHref);
 		window.open("/article/content/"+thisId+aHref);
 	}else{
 	}else{
-		$(".code-text").html('<span><img id="wxpng" src="{{Msg "seo" "cdn"}}/images/wx1.png">微信扫码登录</span><br><span id="freetext">立即免费使用</span>')
-		$('#myModal').modal("show");
+		$('#bidLogin').modal("show");
 	}
 	}
 }
 }
 //
 //