diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 0152b40d1..cda55aa70 100755 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -319,6 +319,88 @@ class User extends Common return DataReturn(empty($result) ? '获取用户信息失败' : $result, -100); } + /** + * QQ小程序获取用户授权 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-10-31 + * @desc description + */ + public function QQUserAuth() + { + // 参数 + if(empty($this->data_post['authcode'])) + { + return DataReturn('授权码为空', -1); + } + + // 授权 + $result = (new \base\QQ(MyC('common_app_mini_qq_appid', '1109990622'), MyC('common_app_mini_qq_appsecret', 'PdVsj1n2sByQQBCi +')))->GetAuthSessionKey($this->data_post['authcode']); + if($result !== false) + { + return DataReturn('授权登录成功', 0, $result); + } + return DataReturn('授权登录失败', -100); + } + + /** + * QQ小程序获取用户信息 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-10-31 + * @desc description + */ + public function QQUserInfo() + { + // 参数校验 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'openid', + 'error_msg' => 'openid为空', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'encrypted_data', + 'error_msg' => '解密数据为空', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'iv', + 'error_msg' => 'iv为空,请重试', + ] + ]; + $ret = ParamsChecked($this->data_post, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // 先从数据库获取用户信息 + $user = UserService::AppUserInfoHandle(null, 'qq_openid', $this->data_post['openid']); + if(empty($user)) + { + $result = (new \base\QQ(MyC('common_app_mini_qq_appid', '1109990622'), MyC('common_app_mini_qq_appsecret', 'PdVsj1n2sByQQBCi +')))->DecryptData($this->data_post['encrypted_data'], $this->data_post['iv'], $this->data_post['openid']); + if(is_array($result)) + { + $result['nick_name'] = isset($result['nickName']) ? $result['nickName'] : ''; + $result['avatar'] = isset($result['avatarUrl']) ? $result['avatarUrl'] : ''; + $result['gender'] = empty($result['gender']) ? 0 : ($result['gender'] == 2) ? 1 : 2; + $result['qq_unionid'] = isset($result['unionId']) ? $result['unionId'] : ''; + $result['openid'] = $result['openId']; + $result['referrer']= isset($this->data_post['referrer']) ? $this->data_post['referrer'] : 0; + return UserService::AuthUserProgram($result, 'qq_openid'); + } + } else { + return DataReturn('授权成功', 0, $user); + } + return DataReturn(empty($result) ? '获取用户信息失败' : $result, -100); + } + /** * [ClientCenter 用户中心] * @author Devil diff --git a/extend/base/QQ.php b/extend/base/QQ.php new file mode 100644 index 000000000..a8dce6422 --- /dev/null +++ b/extend/base/QQ.php @@ -0,0 +1,122 @@ +_appid = $app_id; + $this->_appsecret = $app_secret; + } + + /** + * [DecryptData 检验数据的真实性,并且获取解密后的明文] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2017-12-30T18:20:53+0800 + * @param [string] $encrypted_data [加密的用户数据] + * @param [string] $iv [与用户数据一同返回的初始向量] + * @param [string] $openid [解密后的原文] + * @return [array|string] [成功返回用户信息数组, 失败返回错误信息] + */ + public function DecryptData($encrypted_data, $iv, $openid) + { + // 登录授权session + $login_key = 'qq_user_login_'.$openid; + $session_data = GS($login_key); + if($session_data === false) + { + return 'session key不存在'; + } + + // iv长度 + if(strlen($iv) != 24) + { + return 'iv长度错误'; + } + + // 加密函数 + if(!function_exists('openssl_decrypt')) + { + return 'openssl不支持'; + } + + $aes_cipher = base64_decode($encrypted_data); + $result = openssl_decrypt($aes_cipher, "AES-128-CBC", base64_decode($session_data['session_key']), 1, base64_decode($iv)); + $data = json_decode($result, true); + if($data == NULL) + { + return '请重试!'; + } + if($data['watermark']['appid'] != $this->_appid ) + { + return 'appid不匹配'; + } + + // 缓存存储 + $data_key = 'wechat_user_info_'.$openid; + SS($data_key, $data); + + return $data; + } + + /** + * [GetAuthSessionKey 根据授权code获取 session_key 和 openid] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2017-12-30T18:20:53+0800 + * @param [string] $authcode [用户授权码] + * @return [string|boolean] [失败false, 成功返回appid|] + */ + public function GetAuthSessionKey($authcode) + { + // 请求获取session_key + $url = 'https://api.q.qq.com/sns/jscode2session?appid='.$this->_appid.'&secret='.$this->_appsecret.'&js_code='.$authcode.'&grant_type=authorization_code'; + $result = json_decode(file_get_contents($url), true); + if(!empty($result['openid'])) + { + // 从缓存获取用户信息 + $key = 'qq_user_login_'.$result['openid']; + + // 缓存存储 + SS($key, $result); + return $result['openid']; + } + return false; + } +} +?> \ No newline at end of file diff --git a/public/appmini/old/qq/app.js b/public/appmini/old/qq/app.js new file mode 100755 index 000000000..f93af39cc --- /dev/null +++ b/public/appmini/old/qq/app.js @@ -0,0 +1,519 @@ +App({ + data: { + // 用户登录缓存key + cache_user_login_key: "cache_user_login_key", + + // 用户信息缓存key + cache_user_info_key: "cache_shop_user_info_key", + + // 用户站点信息缓存key + cache_user_merchant_key: "cache_shop_user_merchant_key", + + // 设备信息缓存key + cache_system_info_key: "cache_shop_system_info_key", + + // 用户地址选择缓存key + cache_buy_user_address_select_key: "cache_buy_user_address_select_key", + + // 启动参数缓存key + cache_launch_info_key: "cache_shop_launch_info_key", + + // 默认用户头像 + default_user_head_src: "/images/default-user.png", + + // 成功圆形提示图片 + default_round_success_icon: "/images/default-round-success-icon.png", + + // 错误圆形提示图片 + default_round_error_icon: "/images/default-round-error-icon.png", + + // tabbar页面 + tabbar_pages: [ + "index", + "goods-category", + "cart", + "user", + ], + + // 页面标题 + common_pages_title: { + "goods_search": "商品搜索", + "goods_detail": "商品详情", + "goods_attribute": "属性", + "user_address": "我的地址", + "user_address_save_add": "新增地址", + "user_address_save_edit": "编辑地址", + "buy": "订单确认", + "user_order": "我的订单", + "user_order_detail": "订单详情", + "user_favor": "我的收藏", + "answer_form": "留言", + "answer_list": "问答", + "user_answer_list": "我的留言", + "user": "用户中心", + "goods_category": "分类", + "cart": "购物车", + "message": "消息", + "user_integral": "我的积分", + "user_goods_browse": "我的足迹", + "goods_comment": "商品评论", + "user_orderaftersale": "退款/售后", + "user_orderaftersale_detail": "订单售后", + "user_order_comments": "订单评论", + "coupon": "领劵中心", + "user_coupon": "优惠劵", + }, + + // 请求地址 + request_url: "{{request_url}}", + request_url: 'http://tp5-dev.com/', + //request_url: 'https://test.shopxo.net/', + + // 基础信息 + application_title: "{{application_title}}", + application_describe: "{{application_describe}}", + }, + + /** + * 小程序初始化 + */ + onLaunch(options) { + // 启动参数处理 + options = this.launch_params_handle(options); + + // 设置设备信息 + this.set_system_info(); + + // 缓存启动参数 + qq.setStorage({ + key: this.data.cache_launch_info_key, + data: options + }); + }, + + /** + * 启动参数处理 + */ + launch_params_handle(params) { + // 启动参数处理 + if ((params.query || null) != null) { + params = params.query; + } + if ((params.scene || null) != null) { + params = this.url_params_to_json(decodeURIComponent(params.scene)); + } + return params; + }, + + /** + * 获取设备信息 + */ + get_system_info() { + let system_info = qq.getStorageSync(this.data.cache_system_info_key) || null; + if (system_info == null) { + return this.set_system_info(); + } + return system_info; + }, + + /** + * 设置设备信息 + */ + set_system_info() { + var system_info = qq.getSystemInfoSync(); + qq.setStorage({ + key: this.data.cache_system_info_key, + data: system_info + }); + return system_info; + }, + + /** + /** + * 请求地址生成 + */ + get_request_url(a, c, m, params) { + a = a || "index"; + c = c || "index"; + m = m || "api"; + params = params || ""; + if (params != "" && params.substr(0, 1) != "&") { + params = "&" + params; + } + var user = this.get_user_cache_info(); + var token = (user == false) ? '' : user.token || ''; + return ( + this.data.request_url + + "index.php?s=/" + m + "/" + c + "/" + a + + "&application=app&application_client_type=weixin" + + "&token=" + + token + + "&ajax=ajax" + + params + ); + }, + + /** + * 从缓存获取用户信息 + */ + get_user_cache_info() { + let user = qq.getStorageSync(this.data.cache_user_info_key) || null; + if (user == null) { + return false; + } + return user; + }, + + /** + * 用户登录 + * object 回调操作对象 + * method 回调操作对象的函数 + * auth_data 授权数据 + */ + user_auth_login(object, method, auth_data) { + qq.showLoading({ title: "授权中..." }); + var self = this; + qq.checkSession({ + success: function () { + var openid = qq.getStorageSync(self.data.cache_user_login_key) || null; + if (openid == null) + { + self.user_login(object, method, auth_data); + } else { + self.get_user_login_info(object, method, openid, auth_data); + } + }, + fail: function () { + self.user_login(object, method, auth_data); + } + }); + }, + + /** + * 用户登录 + * object 回调操作对象 + * method 回调操作对象的函数 + * auth_data 授权数据 + */ + user_login(object, method, auth_data) { + var self = this; + qq.login({ + success: (res) => { + if (res.code) { + qq.request({ + url: self.get_request_url('qquserauth', 'user'), + method: 'POST', + data: { authcode: res.code }, + dataType: 'json', + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: (res) => { + if (res.data.code == 0) { + qq.setStorage({ + key: self.data.cache_user_login_key, + data: res.data.data + }); + self.get_user_login_info(object, method, res.data.data, auth_data); + } else { + qq.hideLoading(); + self.showToast(res.data.msg); + } + }, + fail: () => { + qq.hideLoading(); + self.showToast('服务器请求出错'); + }, + }); + } + }, + fail: (e) => { + qq.hideLoading(); + self.showToast('授权失败'); + } + }); + }, + + /** + * 获取用户授权信息 + * object 回调操作对象 + * method 回调操作对象的函数 + * openid 用户openid + * auth_data 授权数据 + */ + get_user_login_info(object, method, openid, auth_data) { + // 邀请人参数 + var params = qq.getStorageSync(this.data.cache_launch_info_key) || null; + var referrer = (params == null) ? 0 : (params.referrer || 0); + + // 远程解密数据 + var self = this; + qq.request({ + url: self.get_request_url('qquserinfo', 'user'), + method: 'POST', + data: { + "encrypted_data": auth_data.encryptedData, + "iv": auth_data.iv, + "openid": openid, + "referrer": referrer + }, + dataType: 'json', + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: (res) => { + qq.hideLoading(); + if (res.data.code == 0) { + qq.setStorage({ + key: self.data.cache_user_info_key, + data: res.data.data, + success: (res) => { + if (typeof object === 'object' && (method || null) != null) { + object[method](); + } + }, + fail: () => { + self.showToast('用户信息缓存失败'); + } + }); + } else { + self.showToast(res.data.msg); + } + }, + fail: () => { + qq.hideLoading(); + self.showToast('服务器请求出错'); + }, + }); + }, + + /** + * 字段数据校验 + * data 待校验的数据, 一维json对象 + * validation 待校验的字段, 格式 [{fields: 'mobile', msg: '请填写手机号码'}, ...] + */ + fields_check(data, validation) { + for (var i in validation) { + var temp_value = data[validation[i]["fields"]]; + var temp_is_can_zero = validation[i]["is_can_zero"] || null; + + if ((temp_value == undefined || temp_value.length == 0 || temp_value == -1) || (temp_is_can_zero == null && temp_value == 0) + ) { + this.showToast(validation[i]['msg']); + return false; + } + } + return true; + }, + + /** + * 获取当前时间戳 + */ + get_timestamp() { + return parseInt(new Date().getTime() / 1000); + }, + + /** + * 获取日期 + * format 日期格式(默认 yyyy-MM-dd h:m:s) + * timestamp 时间戳(默认当前时间戳) + */ + get_date(format, timestamp) { + var d = new Date((timestamp || this.get_timestamp()) * 1000); + var date = { + "M+": d.getMonth() + 1, + "d+": d.getDate(), + "h+": d.getHours(), + "m+": d.getMinutes(), + "s+": d.getSeconds(), + "q+": Math.floor((d.getMonth() + 3) / 3), + "S+": d.getMilliseconds() + }; + if (/(y+)/i.test(format)) { + format = format.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length)); + } + for (var k in date) { + if (new RegExp("(" + k + ")").test(format)) { + format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k] : ("00" + date[k]).substr(("" + date[k]).length)); + } + } + return format; + }, + + /** + * 获取对象、数组的长度、元素个数 + * obj 要计算长度的元素(object、array、string) + */ + get_length(obj) { + var obj_type = typeof obj; + if (obj_type == "string") { + return obj.length; + } else if (obj_type == "object") { + var obj_len = 0; + for (var i in obj) { + obj_len++; + } + return obj_len; + } + return false; + }, + + /** + * 价格保留两位小数 + * price 价格保留两位小数 + */ + price_two_decimal(x) { + var f_x = parseFloat(x); + if (isNaN(f_x)) { + return 0; + } + var f_x = Math.round(x * 100) / 100; + var s_x = f_x.toString(); + var pos_decimal = s_x.indexOf('.'); + if (pos_decimal < 0) { + pos_decimal = s_x.length; + s_x += '.'; + } + while (s_x.length <= pos_decimal + 2) { + s_x += '0'; + } + return s_x; + }, + + /** + * 当前地址是否存在tabbar中 + */ + is_tabbar_pages(url) { + if (url.indexOf("?") == -1) + { + var all = url.split("/"); + } else { + var temp_str = url.split("?"); + var all = temp_str[0].split("/"); + } + if (all.length <= 0) + { + return false; + } + + var temp_tabbar_pages = this.data.tabbar_pages; + for (var i in temp_tabbar_pages) + { + if (temp_tabbar_pages[i] == all[all.length-1]) + { + return true; + } + } + return false; + }, + + /** + * 事件操作 + */ + operation_event(e) { + var value = e.currentTarget.dataset.value || null; + var type = parseInt(e.currentTarget.dataset.type); + if (value != null) { + switch (type) { + // web + case 0: + qq.navigateTo({ url: '/pages/web-view/web-view?url=' + encodeURIComponent(value) }); + break; + + // 内部页面 + case 1: + if (this.is_tabbar_pages(value)) + { + qq.switchTab({ url: value }); + } else { + qq.navigateTo({ url: value }); + } + break; + + // 跳转到外部小程序 + case 2: + qq.navigateToMiniProgram({ appId: value }); + break; + + // 跳转到地图查看位置 + case 3: + var values = value.split('|'); + if (values.length != 4) { + this.showToast('事件值格式有误'); + return false; + } + + qq.openLocation({ + name: values[0], + address: values[1], + longitude: values[2], + latitude: values[3], + }); + break; + + // 拨打电话 + case 4: + qq.makePhoneCall({ phoneNumber: value }); + break; + } + } + }, + + /** + * 默认弱提示方法 + * msg [string] 提示信息 + * status [string] 状态 默认error [正确success, 错误error] + */ + showToast(msg, status) + { + if ((status || 'error') == 'success') + { + qq.showToast({ + title: msg, + duration: 3000 + }); + } else { + qq.showToast({ + image: '/images/default-toast-error.png', + title: msg, + duration: 3000 + }); + } + }, + + /** + * 是否需要登录 + * 是否需要绑定手机号码 + */ + user_is_need_login(user) { + // 用户信息是否正确 + if (user == false) + { + return true; + } + + // 是否需要绑定手机号码 + if ((user.is_mandatory_bind_mobile || 0) == 1) + { + if ((user.mobile || null) == null) + { + return true; + } + } + + return false; + }, + + /** + * url参数转json对象 + */ + url_params_to_json(url_params) { + var json = new Object(); + if ((url_params || null) != null) + { + var arr = url_params.split('&'); + for(var i = 0; i + + {{(propNumber > 99) ? '99+' : propNumber}} + + \ No newline at end of file diff --git a/public/appmini/old/qq/components/badge/badge.qss b/public/appmini/old/qq/components/badge/badge.qss new file mode 100755 index 000000000..7dfb7aef0 --- /dev/null +++ b/public/appmini/old/qq/components/badge/badge.qss @@ -0,0 +1,26 @@ +.am-badge { + display: inline-block; + position: relative; + vertical-align: middle; +} + +.am-badge-text { + display: inline-block; + position: absolute; + right: 0; + transform: translate(50%, -50%); + top: 0px; + min-width: 16px; + padding: 0; + height: 16px; + line-height: 16px; + text-align: center; + background-color: #FF3B30; + border-radius: 16px; + color: #fff; + font-size: 10px; + padding: 1px 1px; +} +.am-badge-text-max { + padding: 1px 2px; +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/icon-nav/icon-nav.js b/public/appmini/old/qq/components/icon-nav/icon-nav.js new file mode 100755 index 000000000..f3d8e94b8 --- /dev/null +++ b/public/appmini/old/qq/components/icon-nav/icon-nav.js @@ -0,0 +1,12 @@ +const app = getApp(); +Component({ + data: {}, + properties: { + propData: Array + }, + methods: { + navigation_event(e) { + app.operation_event(e); + }, + }, +}); diff --git a/public/appmini/old/qq/components/icon-nav/icon-nav.json b/public/appmini/old/qq/components/icon-nav/icon-nav.json new file mode 100755 index 000000000..32640e0dc --- /dev/null +++ b/public/appmini/old/qq/components/icon-nav/icon-nav.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/icon-nav/icon-nav.qml b/public/appmini/old/qq/components/icon-nav/icon-nav.qml new file mode 100755 index 000000000..80db355d4 --- /dev/null +++ b/public/appmini/old/qq/components/icon-nav/icon-nav.qml @@ -0,0 +1,10 @@ + + + + + + + {{item.name}} + + + \ No newline at end of file diff --git a/public/appmini/old/qq/components/icon-nav/icon-nav.qss b/public/appmini/old/qq/components/icon-nav/icon-nav.qss new file mode 100755 index 000000000..4e058d019 --- /dev/null +++ b/public/appmini/old/qq/components/icon-nav/icon-nav.qss @@ -0,0 +1,32 @@ +.data-list { + overflow: hidden; + background: #fff; + margin-bottom: 20rpx; +} +.data-list .items { + width: calc(25% - 60rpx); + float: left; + padding: 30rpx; +} +.items-content { + border-radius: 50%; + padding: 20rpx; + text-align: center; + width: 90rpx; + height: 90rpx; +} +.data-list .items image { + width: 80rpx !important; + height: 80rpx !important; + margin-top: 5rpx; +} +.data-list .items .title { + margin-top: 10rpx; + font-size: 32rpx; + text-align:center; + -o-text-overflow: ellipsis; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + max-width: 100%; +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/popup/popup.js b/public/appmini/old/qq/components/popup/popup.js new file mode 100755 index 000000000..b13a85c2c --- /dev/null +++ b/public/appmini/old/qq/components/popup/popup.js @@ -0,0 +1,30 @@ +// components/popup.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + propClassname: String, + propShow: Boolean, + propPosition: String, + propMask: Boolean, + propAnimation: Boolean, + propDisablescroll: Boolean + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + onMaskTap: function onMaskTap() { + this.triggerEvent('onclose', {}, {}); + } + } +}) diff --git a/public/appmini/old/qq/components/popup/popup.json b/public/appmini/old/qq/components/popup/popup.json new file mode 100755 index 000000000..e8cfaaf80 --- /dev/null +++ b/public/appmini/old/qq/components/popup/popup.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/popup/popup.qml b/public/appmini/old/qq/components/popup/popup.qml new file mode 100755 index 000000000..2780ac4d2 --- /dev/null +++ b/public/appmini/old/qq/components/popup/popup.qml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/public/appmini/old/qq/components/popup/popup.qss b/public/appmini/old/qq/components/popup/popup.qss new file mode 100755 index 000000000..147ac3e23 --- /dev/null +++ b/public/appmini/old/qq/components/popup/popup.qss @@ -0,0 +1,60 @@ +.am-popup-content { + position: fixed; + background:#fff; + z-index: 101; +} + +.am-popup-mask { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background-color: rgba(0, 0, 0, 0.75); + opacity: 0; + pointer-events: none; + z-index: 100; +} + +.am-popup-left { + transform: translateX(-100%); + left: 0; + top: 0; + bottom: 0; +} + +.am-popup-right { + transform: translateX(100%); + right: 0; + top: 0; + bottom: 0; +} + +.am-popup-top { + top: 0; + width: 100vw; + transform: translateY(-100%); +} + +.am-popup-bottom { + bottom: 0; + width: 100vw; + transform: translateY(100%); +} + +.am-popup-show .am-popup-content { + transform: none; +} + +.am-popup-show .am-popup-mask { + opacity: 1; + pointer-events: auto; +} + +.am-popup.animation .am-popup-content { + transition: all 0.15s linear; +} + +.am-popup.animation .am-popup-mask { + transition: all 0.15s linear; +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/slider/slider.js b/public/appmini/old/qq/components/slider/slider.js new file mode 100755 index 000000000..503d474c5 --- /dev/null +++ b/public/appmini/old/qq/components/slider/slider.js @@ -0,0 +1,18 @@ +const app = getApp(); +Component({ + data: { + indicator_dots: false, + indicator_color: 'rgba(0, 0, 0, .3)', + indicator_active_color: '#e31c55', + autoplay: true, + circular: true, + }, + properties: { + propData: Array + }, + methods: { + banner_event(e) { + app.operation_event(e); + }, + }, +}); \ No newline at end of file diff --git a/public/appmini/old/qq/components/slider/slider.json b/public/appmini/old/qq/components/slider/slider.json new file mode 100755 index 000000000..32640e0dc --- /dev/null +++ b/public/appmini/old/qq/components/slider/slider.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/public/appmini/old/qq/components/slider/slider.qml b/public/appmini/old/qq/components/slider/slider.qml new file mode 100755 index 000000000..87c8fe9e0 --- /dev/null +++ b/public/appmini/old/qq/components/slider/slider.qml @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/public/appmini/old/qq/components/slider/slider.qss b/public/appmini/old/qq/components/slider/slider.qss new file mode 100755 index 000000000..07c9c0fc5 --- /dev/null +++ b/public/appmini/old/qq/components/slider/slider.qss @@ -0,0 +1,10 @@ +.banner { + background: #fff; + margin-bottom: 20rpx; +} +.banner image { + min-width: 100%; +} +.banner, .banner image { + height: 320rpx !important; +} \ No newline at end of file diff --git a/public/appmini/old/qq/images/buy-address-divider.png b/public/appmini/old/qq/images/buy-address-divider.png new file mode 100755 index 000000000..60a8f7875 Binary files /dev/null and b/public/appmini/old/qq/images/buy-address-divider.png differ diff --git a/public/appmini/old/qq/images/default-cart-empty.png b/public/appmini/old/qq/images/default-cart-empty.png new file mode 100755 index 000000000..b7a0596c2 Binary files /dev/null and b/public/appmini/old/qq/images/default-cart-empty.png differ diff --git a/public/appmini/old/qq/images/default-cart-icon.png b/public/appmini/old/qq/images/default-cart-icon.png new file mode 100644 index 000000000..260fe785d Binary files /dev/null and b/public/appmini/old/qq/images/default-cart-icon.png differ diff --git a/public/appmini/old/qq/images/default-round-error-icon.png b/public/appmini/old/qq/images/default-round-error-icon.png new file mode 100755 index 000000000..3f2fd1b70 Binary files /dev/null and b/public/appmini/old/qq/images/default-round-error-icon.png differ diff --git a/public/appmini/old/qq/images/default-round-success-icon.png b/public/appmini/old/qq/images/default-round-success-icon.png new file mode 100755 index 000000000..029022a99 Binary files /dev/null and b/public/appmini/old/qq/images/default-round-success-icon.png differ diff --git a/public/appmini/old/qq/images/default-select-active-icon.png b/public/appmini/old/qq/images/default-select-active-icon.png new file mode 100755 index 000000000..12dfcfe38 Binary files /dev/null and b/public/appmini/old/qq/images/default-select-active-icon.png differ diff --git a/public/appmini/old/qq/images/default-select-disabled-icon.png b/public/appmini/old/qq/images/default-select-disabled-icon.png new file mode 100644 index 000000000..1e69d12d8 Binary files /dev/null and b/public/appmini/old/qq/images/default-select-disabled-icon.png differ diff --git a/public/appmini/old/qq/images/default-select-icon.png b/public/appmini/old/qq/images/default-select-icon.png new file mode 100755 index 000000000..466c0ebc0 Binary files /dev/null and b/public/appmini/old/qq/images/default-select-icon.png differ diff --git a/public/appmini/old/qq/images/default-toast-error.png b/public/appmini/old/qq/images/default-toast-error.png new file mode 100755 index 000000000..83eadd245 Binary files /dev/null and b/public/appmini/old/qq/images/default-toast-error.png differ diff --git a/public/appmini/old/qq/images/default-upload-icon.png b/public/appmini/old/qq/images/default-upload-icon.png new file mode 100644 index 000000000..d4343beb2 Binary files /dev/null and b/public/appmini/old/qq/images/default-upload-icon.png differ diff --git a/public/appmini/old/qq/images/default-user.png b/public/appmini/old/qq/images/default-user.png new file mode 100755 index 000000000..ccb06c0ec Binary files /dev/null and b/public/appmini/old/qq/images/default-user.png differ diff --git a/public/appmini/old/qq/images/default-xingxing-icon-active.png b/public/appmini/old/qq/images/default-xingxing-icon-active.png new file mode 100644 index 000000000..162d78ab5 Binary files /dev/null and b/public/appmini/old/qq/images/default-xingxing-icon-active.png differ diff --git a/public/appmini/old/qq/images/default-xingxing-icon.png b/public/appmini/old/qq/images/default-xingxing-icon.png new file mode 100644 index 000000000..a2ee84c5e Binary files /dev/null and b/public/appmini/old/qq/images/default-xingxing-icon.png differ diff --git a/public/appmini/old/qq/images/empty.png b/public/appmini/old/qq/images/empty.png new file mode 100755 index 000000000..71fed2f12 Binary files /dev/null and b/public/appmini/old/qq/images/empty.png differ diff --git a/public/appmini/old/qq/images/error.png b/public/appmini/old/qq/images/error.png new file mode 100755 index 000000000..db1478bb2 Binary files /dev/null and b/public/appmini/old/qq/images/error.png differ diff --git a/public/appmini/old/qq/images/goods-detail-favor-icon-0.png b/public/appmini/old/qq/images/goods-detail-favor-icon-0.png new file mode 100755 index 000000000..b1c8a5e13 Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-favor-icon-0.png differ diff --git a/public/appmini/old/qq/images/goods-detail-favor-icon-1.png b/public/appmini/old/qq/images/goods-detail-favor-icon-1.png new file mode 100755 index 000000000..5821e3e94 Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-favor-icon-1.png differ diff --git a/public/appmini/old/qq/images/goods-detail-home-icon.png b/public/appmini/old/qq/images/goods-detail-home-icon.png new file mode 100755 index 000000000..a1d37089e Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-home-icon.png differ diff --git a/public/appmini/old/qq/images/goods-detail-share-icon.png b/public/appmini/old/qq/images/goods-detail-share-icon.png new file mode 100755 index 000000000..329e89b7a Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-share-icon.png differ diff --git a/public/appmini/old/qq/images/goods-detail-shop-icon.png b/public/appmini/old/qq/images/goods-detail-shop-icon.png new file mode 100755 index 000000000..d8f173b7d Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-shop-icon.png differ diff --git a/public/appmini/old/qq/images/goods-detail-video-close.png b/public/appmini/old/qq/images/goods-detail-video-close.png new file mode 100644 index 000000000..3356ecb57 Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-video-close.png differ diff --git a/public/appmini/old/qq/images/goods-detail-video-play.png b/public/appmini/old/qq/images/goods-detail-video-play.png new file mode 100644 index 000000000..789c39849 Binary files /dev/null and b/public/appmini/old/qq/images/goods-detail-video-play.png differ diff --git a/public/appmini/old/qq/images/home-consulting-image.jpg b/public/appmini/old/qq/images/home-consulting-image.jpg new file mode 100755 index 000000000..9aa888ccf Binary files /dev/null and b/public/appmini/old/qq/images/home-consulting-image.jpg differ diff --git a/public/appmini/old/qq/images/limitedtimediscount-nav-icon.png b/public/appmini/old/qq/images/limitedtimediscount-nav-icon.png new file mode 100644 index 000000000..49b0f380c Binary files /dev/null and b/public/appmini/old/qq/images/limitedtimediscount-nav-icon.png differ diff --git a/public/appmini/old/qq/images/nav-icon-cart-active.png b/public/appmini/old/qq/images/nav-icon-cart-active.png new file mode 100755 index 000000000..34b341f6d Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-cart-active.png differ diff --git a/public/appmini/old/qq/images/nav-icon-cart.png b/public/appmini/old/qq/images/nav-icon-cart.png new file mode 100644 index 000000000..15b0208f4 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-cart.png differ diff --git a/public/appmini/old/qq/images/nav-icon-category-active.png b/public/appmini/old/qq/images/nav-icon-category-active.png new file mode 100755 index 000000000..8db743b75 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-category-active.png differ diff --git a/public/appmini/old/qq/images/nav-icon-category.png b/public/appmini/old/qq/images/nav-icon-category.png new file mode 100755 index 000000000..b0464d183 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-category.png differ diff --git a/public/appmini/old/qq/images/nav-icon-home-active.png b/public/appmini/old/qq/images/nav-icon-home-active.png new file mode 100755 index 000000000..3d62e9114 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-home-active.png differ diff --git a/public/appmini/old/qq/images/nav-icon-home.png b/public/appmini/old/qq/images/nav-icon-home.png new file mode 100755 index 000000000..b90a704e3 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-home.png differ diff --git a/public/appmini/old/qq/images/nav-icon-user-active.png b/public/appmini/old/qq/images/nav-icon-user-active.png new file mode 100755 index 000000000..2ef2eaef0 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-user-active.png differ diff --git a/public/appmini/old/qq/images/nav-icon-user.png b/public/appmini/old/qq/images/nav-icon-user.png new file mode 100755 index 000000000..e8531f430 Binary files /dev/null and b/public/appmini/old/qq/images/nav-icon-user.png differ diff --git a/public/appmini/old/qq/images/search-asc-icon.png b/public/appmini/old/qq/images/search-asc-icon.png new file mode 100755 index 000000000..0b16b29ca Binary files /dev/null and b/public/appmini/old/qq/images/search-asc-icon.png differ diff --git a/public/appmini/old/qq/images/search-default-icon.png b/public/appmini/old/qq/images/search-default-icon.png new file mode 100755 index 000000000..d91a76411 Binary files /dev/null and b/public/appmini/old/qq/images/search-default-icon.png differ diff --git a/public/appmini/old/qq/images/search-desc-icon.png b/public/appmini/old/qq/images/search-desc-icon.png new file mode 100755 index 000000000..9e79244e9 Binary files /dev/null and b/public/appmini/old/qq/images/search-desc-icon.png differ diff --git a/public/appmini/old/qq/images/search-submit-icon.png b/public/appmini/old/qq/images/search-submit-icon.png new file mode 100755 index 000000000..af5205981 Binary files /dev/null and b/public/appmini/old/qq/images/search-submit-icon.png differ diff --git a/public/appmini/old/qq/images/share-friend-icon.png b/public/appmini/old/qq/images/share-friend-icon.png new file mode 100644 index 000000000..d9f453dab Binary files /dev/null and b/public/appmini/old/qq/images/share-friend-icon.png differ diff --git a/public/appmini/old/qq/images/share-recomend-icon.png b/public/appmini/old/qq/images/share-recomend-icon.png new file mode 100644 index 000000000..55b727af6 Binary files /dev/null and b/public/appmini/old/qq/images/share-recomend-icon.png differ diff --git a/public/appmini/old/qq/images/share-weixin-icon.png b/public/appmini/old/qq/images/share-weixin-icon.png new file mode 100644 index 000000000..4ad5abe78 Binary files /dev/null and b/public/appmini/old/qq/images/share-weixin-icon.png differ diff --git a/public/appmini/old/qq/images/tips.png b/public/appmini/old/qq/images/tips.png new file mode 100755 index 000000000..bf59c3cf1 Binary files /dev/null and b/public/appmini/old/qq/images/tips.png differ diff --git a/public/appmini/old/qq/images/upload.png b/public/appmini/old/qq/images/upload.png new file mode 100755 index 000000000..98c89f040 Binary files /dev/null and b/public/appmini/old/qq/images/upload.png differ diff --git a/public/appmini/old/qq/images/user-address.png b/public/appmini/old/qq/images/user-address.png new file mode 100755 index 000000000..b3d1b7530 Binary files /dev/null and b/public/appmini/old/qq/images/user-address.png differ diff --git a/public/appmini/old/qq/images/user-head-message-icon.png b/public/appmini/old/qq/images/user-head-message-icon.png new file mode 100755 index 000000000..c1b03e367 Binary files /dev/null and b/public/appmini/old/qq/images/user-head-message-icon.png differ diff --git a/public/appmini/old/qq/images/user-index-nav-order-icon-1.png b/public/appmini/old/qq/images/user-index-nav-order-icon-1.png new file mode 100755 index 000000000..b17897383 Binary files /dev/null and b/public/appmini/old/qq/images/user-index-nav-order-icon-1.png differ diff --git a/public/appmini/old/qq/images/user-index-nav-order-icon-101.png b/public/appmini/old/qq/images/user-index-nav-order-icon-101.png new file mode 100644 index 000000000..d8cd649a2 Binary files /dev/null and b/public/appmini/old/qq/images/user-index-nav-order-icon-101.png differ diff --git a/public/appmini/old/qq/images/user-index-nav-order-icon-2.png b/public/appmini/old/qq/images/user-index-nav-order-icon-2.png new file mode 100755 index 000000000..fb20b6866 Binary files /dev/null and b/public/appmini/old/qq/images/user-index-nav-order-icon-2.png differ diff --git a/public/appmini/old/qq/images/user-index-nav-order-icon-3.png b/public/appmini/old/qq/images/user-index-nav-order-icon-3.png new file mode 100755 index 000000000..61483e02c Binary files /dev/null and b/public/appmini/old/qq/images/user-index-nav-order-icon-3.png differ diff --git a/public/appmini/old/qq/images/user-index-nav-order-icon-4.png b/public/appmini/old/qq/images/user-index-nav-order-icon-4.png new file mode 100755 index 000000000..db15f17c0 Binary files /dev/null and b/public/appmini/old/qq/images/user-index-nav-order-icon-4.png differ diff --git a/public/appmini/old/qq/images/user-nav-cache-icon.png b/public/appmini/old/qq/images/user-nav-cache-icon.png new file mode 100644 index 000000000..307071a03 Binary files /dev/null and b/public/appmini/old/qq/images/user-nav-cache-icon.png differ diff --git a/public/appmini/old/qq/images/user-nav-customer-service-icon.png b/public/appmini/old/qq/images/user-nav-customer-service-icon.png new file mode 100644 index 000000000..7313d6c97 Binary files /dev/null and b/public/appmini/old/qq/images/user-nav-customer-service-icon.png differ diff --git a/public/appmini/old/qq/images/user-nav-order-icon.png b/public/appmini/old/qq/images/user-nav-order-icon.png new file mode 100644 index 000000000..525142b06 Binary files /dev/null and b/public/appmini/old/qq/images/user-nav-order-icon.png differ diff --git a/public/appmini/old/qq/pages/answer-form/answer-form.js b/public/appmini/old/qq/pages/answer-form/answer-form.js new file mode 100755 index 000000000..d2d9c2db7 --- /dev/null +++ b/public/appmini/old/qq/pages/answer-form/answer-form.js @@ -0,0 +1,77 @@ +const app = getApp(); +Page({ + data: { + form_submit_loading: false, + }, + + onLoad() {}, + + onShow() { + qq.setNavigationBarTitle({title: app.data.common_pages_title.answer_form}); + this.init(); + }, + + // 初始化 + init() { + var user = app.get_user_cache_info(this, "init"); + // 用户未绑定用户则转到登录页面 + if (app.user_is_need_login(user)) { + qq.redirectTo({ + url: "/pages/login/login?event_callback=init" + }); + return false; + } + }, + + /** + * 表单提交 + */ + formSubmit(e) + { + // 数据验证 + var validation = [ + {fields: 'name', msg: '请填写联系人'}, + {fields: 'tel', msg: '请填写联系电话'}, + {fields: 'content', msg: '请填写内容'} + ]; + if(app.fields_check(e.detail.value, validation)) + { + qq.showLoading({title: '提交中...'}); + this.setData({form_submit_loading: true}); + + // 网络请求 + qq.request({ + url: app.get_request_url('add', 'answer'), + method: 'POST', + data: e.detail.value, + dataType: 'json', + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: (res) => { + qq.hideLoading(); + + if(res.data.code == 0) + { + app.showToast(res.data.msg, "success"); + setTimeout(function() + { + qq.redirectTo({ + url: "/pages/user-answer-list/user-answer-list" + }); + }, 2000); + } else { + this.setData({form_submit_loading: false}); + + app.showToast(res.data.msg); + } + }, + fail: () => { + qq.hideLoading(); + this.setData({form_submit_loading: false}); + + app.showToast('服务器请求出错'); + } + }); + } + }, + +}); diff --git a/public/appmini/old/qq/pages/answer-form/answer-form.json b/public/appmini/old/qq/pages/answer-form/answer-form.json new file mode 100755 index 000000000..9a5b68f95 --- /dev/null +++ b/public/appmini/old/qq/pages/answer-form/answer-form.json @@ -0,0 +1,3 @@ +{ + "enablePullDownRefresh": false +} \ No newline at end of file diff --git a/public/appmini/old/qq/pages/answer-form/answer-form.qml b/public/appmini/old/qq/pages/answer-form/answer-form.qml new file mode 100755 index 000000000..2ac666ce6 --- /dev/null +++ b/public/appmini/old/qq/pages/answer-form/answer-form.qml @@ -0,0 +1,15 @@ +
+ + + + + + + +