setting.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <view>
  3. <!-- 设置 -->
  4. <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  5. :show-head="false" @click="tishi">
  6. <view slot="body">
  7. <view class="u-flex u-row-between">
  8. <view class="">
  9. <u-image width="130rpx" height="130rpx" :src="userInfo.storeImageUrl" :lazy-load="true" shape="circle">
  10. <view slot="error" style="font-size: 24rpx" :fade="true" duration="450">加载失败
  11. </view>
  12. </u-image>
  13. </view>
  14. <view class="u-flex">
  15. <!-- <view class="u-m-r-50" style="color: #0d79ec; font-size: 32rpx">修改门头照</view> -->
  16. <u-icon name="arrow-right" color="#0D79EC" size="28"></u-icon>
  17. </view>
  18. </view>
  19. </view>
  20. </u-card>
  21. <u-card :border="false" padding="20" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false"
  22. :show-head="false">
  23. <view slot="body">
  24. <template>
  25. <u-cell-group :border="false">
  26. <u-cell-item title="收货地址管理" @click="tishi">
  27. <u-icon slot="icon" size="42" name="location-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  28. </u-cell-item>
  29. <u-cell-item title="门店名称" :value="userInfo.storeName" :arrow="false">
  30. <u-icon slot="icon" size="42" name="shop-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  31. </u-cell-item>
  32. <u-cell-item title="门店联系人" :value="userInfo.contactName" :arrow="false">
  33. <u-icon slot="icon" size="42" name="contact" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  34. </u-cell-item>
  35. <u-cell-item title="联系电话" :value="userInfo.storePhone" :arrow="false">
  36. <u-icon slot="icon" size="42" name="phone-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  37. </u-cell-item>
  38. <u-cell-item title="用户协议">
  39. <u-icon slot="icon" size="42" name="friends-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  40. </u-cell-item>
  41. <u-cell-item title="隐私政策">
  42. <u-icon slot="icon" size="42" name="info-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  43. </u-cell-item>
  44. <u-cell-item title="版本检测" :value="edition_s" :arrow="false" :border-bottom="false" @click="edition">
  45. <u-icon slot="icon" size="42" name="setting-o" custom-prefix="van-icon" color="#0095FF" style="margin-right: 10rpx"></u-icon>
  46. </u-cell-item>
  47. </u-cell-group>
  48. </template>
  49. </view>
  50. </u-card>
  51. <u-button type="primary" @click="exit" style="margin: 20rpx">安全退出</u-button>
  52. <luo-version-upgrade v-if="show_s == true" version="1.0.1" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. mapMutations
  58. } from "vuex";
  59. import {
  60. request
  61. } from "../../../common/request/request";
  62. require("promise.prototype.finally").shim();
  63. export default {
  64. data() {
  65. return {
  66. userInfo: {},
  67. edition_s: '',
  68. show_s: false,
  69. url: '',
  70. is_force: false,
  71. Copywriting: ''
  72. };
  73. },
  74. created() {
  75. this.getMyinfo();
  76. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  77. console.log(wgtinfo);
  78. console.log(wgtinfo.version); //版本号
  79. this.edition_s = wgtinfo.version
  80. })
  81. },
  82. methods: {
  83. ...mapMutations(["logout"]),
  84. exit() {
  85. this.logout();
  86. this.$u.route({
  87. url: "pages/login/index",
  88. type: "reLaunch",
  89. });
  90. },
  91. edition() {
  92. uni.getSystemInfo({
  93. success: res => {
  94. console.log(res.platform);
  95. },
  96. complete: err => {
  97. if (err.platform == 'android') {
  98. this.onLaunch_s()
  99. } else if (err.platform == 'ios') {
  100. console.log("暂无数据")
  101. this.iosstartup()
  102. }
  103. }
  104. });
  105. },
  106. iosstartup(){
  107. request({
  108. url: '/baseReq/apkUpgrade',
  109. method: 'get',
  110. params: {
  111. osType: 1
  112. }
  113. }).then(res => {
  114. console.log(res)
  115. console.log(res.data.code)
  116. console.log(res.data.forceVersion) //最低版本
  117. console.log(res.data.msg) //更新文案
  118. console.log(res.data.version) //最新版本
  119. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  120. console.log(wgtinfo);
  121. console.log(wgtinfo.version); //版本号
  122. if (wgtinfo.version == res.data.version) {
  123. this.show_s = true
  124. uni.showToast({
  125. icon: 'none',
  126. title: '已是最新版本',
  127. position: "bottom"
  128. })
  129. console.log("已是最新版本")
  130. } else if (wgtinfo.version != res.data.forceVersion) {
  131. console.log("强制版本更新")
  132. res.data.msg = res.data.msg.replace(/\\n/g,"\n")
  133. uni.showModal({
  134. title: "发现新版本",
  135. content: res.data.msg,
  136. showCancel: false,
  137. confirmText: "立即去AppStore更新",
  138. success: function(res) {
  139. if (res.confirm) {
  140. console.log('用户点击确定');
  141. let appleId = 1518555723
  142. plus.runtime.launchApplication({
  143. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  144. }, function(e) {
  145. console.log('Open system default browser failed: ' + e.message);
  146. });
  147. } else if (res.cancel) {
  148. console.log('用户点击取消');
  149. }
  150. }
  151. })
  152. } else if (wgtinfo.version == res.data.forceVersion) {
  153. console.log("最低版本更新")
  154. res.data.msg = res.data.msg.replace(/\\n/g,"\n")
  155. uni.showModal({
  156. title: "发现新版本",
  157. content: res.data.msg,
  158. showCancel: true,
  159. confirmText: "立即去AppStore更新",
  160. success: function(res) {
  161. if (res.confirm) {
  162. console.log('用户点击确定');
  163. let appleId = 1518555723
  164. plus.runtime.launchApplication({
  165. action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
  166. }, function(e) {
  167. console.log('Open system default browser failed: ' + e.message);
  168. });
  169. } else if (res.cancel) {
  170. console.log('用户点击取消');
  171. }
  172. }
  173. })
  174. }
  175. })
  176. }).catch(err => {
  177. console.log(err)
  178. })
  179. .finally(() => {
  180. // Loading.close()
  181. })
  182. },
  183. onLaunch_s() {
  184. //升级调用的接口
  185. if (this.show_s == true) {
  186. this.show_s = false
  187. }
  188. console.log(this.show_s)
  189. request({
  190. url: '/baseReq/apkUpgrade',
  191. method: 'get',
  192. params: {
  193. osType: 0
  194. }
  195. }).then(res => {
  196. console.log(res)
  197. console.log(res.data.forceVersion) //最低版本
  198. console.log(res.data.msg) //更新文案
  199. console.log(res.data.url) //下载最新版地址
  200. console.log(res.data.version) //最新版本
  201. plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
  202. console.log(wgtinfo);
  203. console.log(wgtinfo.version); //版本号
  204. if (wgtinfo.version == res.data.version) {
  205. this.show_s = false
  206. uni.showToast({
  207. icon: 'none',
  208. title: '已经是最新版本了',
  209. position: "bottom"
  210. })
  211. this.closeModal();
  212. console.log("已经是最新版本了")
  213. } else if (wgtinfo.version != res.data.forceVersion) {
  214. console.log("必须强制更新")
  215. this.Copywriting = res.data.msg
  216. this.show_s = true
  217. console.log(res.data.url)
  218. this.url = res.data.url
  219. this.is_force = true
  220. } else if (wgtinfo.version == res.data.forceVersion) {
  221. console.log("达到最低版本")
  222. this.Copywriting = res.data.msg
  223. console.log(this.Copywriting)
  224. this.is_force = false
  225. this.show_s = true
  226. console.log(this.show_s)
  227. this.url = res.data.url
  228. }
  229. })
  230. }).catch(err => {
  231. console.log(err)
  232. })
  233. .finally(() => {
  234. // Loading.close()
  235. })
  236. },
  237. getMyinfo() {
  238. request({
  239. url: "/myapp/selectStore",
  240. method: "post",
  241. data: {
  242. storeId: this.$store.state.storeInfo.storeId,
  243. },
  244. })
  245. .then((res) => {
  246. this.userInfo = res.data.data;
  247. console.log(this.userInfo);
  248. })
  249. .catch((err) => {
  250. console.log(err);
  251. })
  252. .finally(() => {
  253. this.loading = false;
  254. uni.hideLoading();
  255. });
  256. },
  257. tishi() {
  258. this.$u.toast('此功能暂不开放');
  259. }
  260. },
  261. };
  262. </script>
  263. <style>
  264. </style>